diff --git a/apps/product/services/quota_dashboard_service.py b/apps/product/services/quota_dashboard_service.py index 19fe1f9..b6fbfda 100644 --- a/apps/product/services/quota_dashboard_service.py +++ b/apps/product/services/quota_dashboard_service.py @@ -14,7 +14,7 @@ class QuotaDashboardService: @staticmethod def get_dashboard(self, org: Organization, start_date: str = None, end_date: str = None, - search_fields: list[str] = None, quota_is_closed: bool = False): + search_fields: list[str] = None, quota_is_closed: bool = False, query_string: str = None): if org.type.key == 'ADM': org_quota_stats = OrganizationQuotaStats.objects.filter(stat_type='quota', quota__is_closed=quota_is_closed) @@ -32,7 +32,8 @@ class QuotaDashboardService: start=start_date, end=end_date, date_field="create_date", - search_fields=search_fields + search_fields=search_fields, + query_string=query_string ).apply() org_quota_stats = org_quota_stats.aggregate( diff --git a/apps/product/web/api/v1/viewsets/quota_api.py b/apps/product/web/api/v1/viewsets/quota_api.py index 6fa2baf..286a9bc 100644 --- a/apps/product/web/api/v1/viewsets/quota_api.py +++ b/apps/product/web/api/v1/viewsets/quota_api.py @@ -381,6 +381,7 @@ class QuotaViewSet(BaseViewSet, SoftDeleteMixin, QuotaDashboardService, viewsets # filter by date start_date = query_param.get('start') if 'start' in query_param.keys() else None end_date = query_param.get('end') if 'end' in query_param.keys() else None + query_string = query_param.get('search') if 'search' in query_param.keys() else None # filter by quota is close or open is_closed = True if 'is_closed' in query_param.keys() else False @@ -391,7 +392,8 @@ class QuotaViewSet(BaseViewSet, SoftDeleteMixin, QuotaDashboardService, viewsets start_date=start_date, end_date=end_date, search_fields=search_fields, - quota_is_closed=is_closed + quota_is_closed=is_closed, + query_string=query_string ) return Response(quota_dashboard)