From c5630c433e6bfd29c4369712083bd0dd98d23d43 Mon Sep 17 00:00:00 2001 From: irfanuddinahmad Date: Tue, 19 Nov 2024 18:45:21 +0500 Subject: [PATCH] feat: expanded page_size for reporting configurations --- CHANGELOG.rst | 4 ++++ enterprise/__init__.py | 2 +- .../api/v1/views/enterprise_customer_reporting.py | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 145eb69c79..415d6f2f92 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -17,6 +17,10 @@ Unreleased ---------- * nothing unreleased +[4.33.0] +-------- +* feat: Updated pagination for reporting configurations. + [4.32.3] -------- * chore: Update python requirements. diff --git a/enterprise/__init__.py b/enterprise/__init__.py index f1d10ef982..87be534dcb 100644 --- a/enterprise/__init__.py +++ b/enterprise/__init__.py @@ -2,4 +2,4 @@ Your project description goes here. """ -__version__ = "4.32.3" +__version__ = "4.33.0" diff --git a/enterprise/api/v1/views/enterprise_customer_reporting.py b/enterprise/api/v1/views/enterprise_customer_reporting.py index c35783cce8..ff82aa48c7 100644 --- a/enterprise/api/v1/views/enterprise_customer_reporting.py +++ b/enterprise/api/v1/views/enterprise_customer_reporting.py @@ -6,6 +6,7 @@ from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication from rest_framework import permissions, status from rest_framework.authentication import SessionAuthentication +from rest_framework.pagination import PageNumberPagination from rest_framework.response import Response from rest_framework.status import HTTP_200_OK, HTTP_404_NOT_FOUND from rest_framework.views import APIView @@ -17,6 +18,14 @@ from enterprise.utils import get_enterprise_customer +class ExpandDefaultPageSize(PageNumberPagination): + """ + Expands page size for the API. + Used to populate large reporting configurations. + """ + page_size = 100 + + class EnterpriseCustomerReportingConfigurationViewSet(EnterpriseReadWriteModelViewSet): """ API views for the ``enterprise-customer-reporting`` API endpoint. @@ -26,6 +35,7 @@ class EnterpriseCustomerReportingConfigurationViewSet(EnterpriseReadWriteModelVi serializer_class = serializers.EnterpriseCustomerReportingConfigurationSerializer lookup_field = 'uuid' permission_classes = [permissions.IsAuthenticated] + pagination_class = ExpandDefaultPageSize USER_ID_FILTER = 'enterprise_customer__enterprise_customer_users__user_id' FIELDS = (