add pos device - fix closed quotas pagination

This commit is contained in:
2025-07-24 16:02:08 +03:30
parent f8dbe0ab29
commit 18fd27a9c4
9 changed files with 246 additions and 31 deletions

View File

@@ -268,6 +268,12 @@ class QuotaViewSet(viewsets.ModelViewSet): # noqa
return Response(status.HTTP_200_OK)
@action(
methods=['patch'],
)
def activate(self, request):
pass
@action(
methods=['get'],
detail=False,
@@ -305,6 +311,7 @@ class QuotaViewSet(viewsets.ModelViewSet): # noqa
""" list of organization closed quotas """
organization = get_organization_by_user(request.user)
# paginate queryset
page = self.paginate_queryset(
self.queryset.filter(
@@ -412,26 +419,6 @@ class QuotaViewSet(viewsets.ModelViewSet): # noqa
serializer = self.serializer_class(quotas, many=True).data
return Response(serializer, status=status.HTTP_200_OK)
@action(
methods=['get'],
detail=False,
url_path='closed_quotas',
url_name='closed_quotas',
name='closed_quotas'
)
def closed_quotas(self, request):
""" get list of close quotas for organization """
quotas = quotas = self.queryset.filter(
(Q(assigned_organizations=get_organization_by_user(request.user)) |
Q(registerer_organization=get_organization_by_user(request.user))) &
Q(is_closed=True)
)
serialize = self.serializer_class(quotas, many=True).data
return Response(serialize, status=status.HTTP_200_OK)
@action(
methods=['put'],
detail=True,