add new apis

This commit is contained in:
behruz-dev
2025-08-01 17:28:48 +05:00
parent f757e42906
commit 4c6a0b4445
17 changed files with 205 additions and 42 deletions

View File

View File

@@ -0,0 +1,22 @@
from rest_framework.pagination import PageNumberPagination
from rest_framework.pagination import PageNumberPagination
from rest_framework.response import Response
class CustomPageNumberPagination(PageNumberPagination):
page_size = 10
page_query_param = 'page'
page_size_query_param = 'page_size'
max_page_size = 100
def get_paginated_response(self, data):
return Response({
'total': self.page.paginator.count,
'page': self.page.number,
'page_size': self.get_page_size(self.request),
'total_pages': self.page.paginator.num_pages,
'has_next': self.page.has_next(),
'has_previous': self.page.has_previous(),
'results': data
})