From c02644a587eeeb25489caf7cbaf78b777610f46d Mon Sep 17 00:00:00 2001 From: behruz-dev Date: Tue, 16 Sep 2025 15:51:16 +0500 Subject: [PATCH] add: add new api --- core/apps/counterparty/urls.py | 1 + core/apps/counterparty/views/counterparty.py | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/apps/counterparty/urls.py b/core/apps/counterparty/urls.py index 8c009a9..fbbc08e 100644 --- a/core/apps/counterparty/urls.py +++ b/core/apps/counterparty/urls.py @@ -16,6 +16,7 @@ urlpatterns = [ path('statistics/', cp_views.CounterpartyStatisticsApiView.as_view()), path('all/', cp_views.CounterpartiesApiView.as_view()), path("/", cp_views.CounterpartyDetailApiView.as_view()), + path('/un_archive/', cp_views.UnArchiveCounterpartyApiView.as_view()), ] )), path('counterparty_folder/', include( diff --git a/core/apps/counterparty/views/counterparty.py b/core/apps/counterparty/views/counterparty.py index b595d7d..57f8709 100644 --- a/core/apps/counterparty/views/counterparty.py +++ b/core/apps/counterparty/views/counterparty.py @@ -149,4 +149,16 @@ class CounterpartyDetailApiView(views.APIView): def get(self, request, id): obj = get_object_or_404(Counterparty, id=id) serializer = serializers.CounterpartyListSerializer(obj) - return Response(serializer.data, status=200) \ No newline at end of file + return Response(serializer.data, status=200) + + +class UnArchiveCounterpartyApiView(views.APIView): + permission_classes = [HasRolePermission] + + def get(self, request, id): + obj = get_object_or_404(Counterparty, id=id) + obj.is_archived = False + obj.save() + return Response( + {'success': True, 'message': 'Conterparty unarchived'}, status=200 + )