From da51d8159c630eaa07f711057382430ce9f17c8a Mon Sep 17 00:00:00 2001 From: behruz-dev Date: Wed, 3 Sep 2025 17:21:15 +0500 Subject: [PATCH] add: add archived coutnerparty list api --- core/apps/counterparty/urls.py | 1 + core/apps/counterparty/views/counterparty.py | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/apps/counterparty/urls.py b/core/apps/counterparty/urls.py index c095561..09fba52 100644 --- a/core/apps/counterparty/urls.py +++ b/core/apps/counterparty/urls.py @@ -10,6 +10,7 @@ urlpatterns = [ path('list/', cp_views.CounterpartyListApiView.as_view()), path('create/', cp_views.CounterpartyCreateApiView.as_view()), path('/archive/', cp_views.ArchiveCounterpartyApiView.as_view()), + path('archived/list/', cp_views.ArchivedCounterpartyListApiView.as_view()), ] )), path('counterparty_folder/', include( diff --git a/core/apps/counterparty/views/counterparty.py b/core/apps/counterparty/views/counterparty.py index 6225949..7f06fe5 100644 --- a/core/apps/counterparty/views/counterparty.py +++ b/core/apps/counterparty/views/counterparty.py @@ -48,4 +48,12 @@ class ArchiveCounterpartyApiView(views.APIView): return Response( {'success': True, 'message': 'counterparty archived'}, status=200 - ) \ No newline at end of file + ) + + +class ArchivedCounterpartyListApiView(generics.ListAPIView): + serializer_class = serializers.CounterpartyListSerializer + queryset = Counterparty.objects.exclude(is_archived=False) + pagination_class = [HasRolePermission] + required_permissions = [] + pagination_class = CustomPageNumberPagination \ No newline at end of file