diff --git a/core/apps/counterparty/urls.py b/core/apps/counterparty/urls.py index fbbc08e..14ccb0a 100644 --- a/core/apps/counterparty/urls.py +++ b/core/apps/counterparty/urls.py @@ -17,6 +17,7 @@ urlpatterns = [ path('all/', cp_views.CounterpartiesApiView.as_view()), path("/", cp_views.CounterpartyDetailApiView.as_view()), path('/un_archive/', cp_views.UnArchiveCounterpartyApiView.as_view()), + path('all/', cp_views.AllCounterpartyListApiView.as_view()), ] )), path('counterparty_folder/', include( diff --git a/core/apps/counterparty/views/counterparty.py b/core/apps/counterparty/views/counterparty.py index 34af2da..ed4f092 100644 --- a/core/apps/counterparty/views/counterparty.py +++ b/core/apps/counterparty/views/counterparty.py @@ -156,3 +156,15 @@ class UnArchiveCounterpartyApiView(views.APIView): return Response( {'success': True, 'message': 'Conterparty unarchived'}, status=200 ) + + +class AllCounterpartyListApiView(generics.GenericAPIView): + serializer_class = serializers.CounterpartyListSerializer + queryset = Counterparty.objects.all() + permission_classes = [HasRolePermission] + + def get(self, request): + page = self.paginate_queryset(self.queryset) + if page is not None: + serializer = self.serializer_class(page, many=True) + return self.get_paginated_response(serializer.data)