From 2d8d35a9c350ae0fec65ca3870cf4f9b969d2d97 Mon Sep 17 00:00:00 2001 From: sudip-khanal Date: Thu, 2 Jul 2026 11:04:34 +0545 Subject: [PATCH] feat(report): add title filter on capacity and resource --- apps/dashboards/graphql/filters.py | 1 + apps/reports/graphql/types.py | 4 +++- helm/snapshots/alpha.yaml | 22 ++++++++++++---------- helm/tests/alpha.yaml | 1 + helm/values.yaml | 4 ++++ schema.graphql | 3 ++- 6 files changed, 23 insertions(+), 12 deletions(-) diff --git a/apps/dashboards/graphql/filters.py b/apps/dashboards/graphql/filters.py index 873e2a5..c79b609 100644 --- a/apps/dashboards/graphql/filters.py +++ b/apps/dashboards/graphql/filters.py @@ -34,6 +34,7 @@ def capacity_and_resources(self, queryset, value: list[strawberry.ID], prefix: s class CapacityAndResourceFilter: id: strawberry.ID | None = strawberry.UNSET is_active: bool | None = strawberry.UNSET + title: strawberry.auto @strawberry_django.filter_field def search(self, value: str, prefix: str) -> Q: diff --git a/apps/reports/graphql/types.py b/apps/reports/graphql/types.py index 22d8584..89da08d 100644 --- a/apps/reports/graphql/types.py +++ b/apps/reports/graphql/types.py @@ -1,5 +1,6 @@ import strawberry import strawberry_django +from asgiref.sync import sync_to_async from apps.reports.models import ( DocumentExtraction, @@ -56,7 +57,7 @@ class ReportType: iframe_url: strawberry.auto visibility: ReportVisibility report_type: ReportTypeEnum - thematic_area_id: strawberry.ID + thematic_area_id: strawberry.ID | None @strawberry.field def content_type_display(self) -> str: @@ -67,6 +68,7 @@ def visibility_display(self) -> str: return self.get_visibility_display() # type: ignore[reportAttributeAccessIssue] @strawberry.field + @sync_to_async def report_type_display(self) -> str: return self.get_report_type_display() # type: ignore[reportAttributeAccessIssue] diff --git a/helm/snapshots/alpha.yaml b/helm/snapshots/alpha.yaml index f722b27..a363c71 100644 --- a/helm/snapshots/alpha.yaml +++ b/helm/snapshots/alpha.yaml @@ -216,6 +216,7 @@ stringData: POSTGRES_PASSWORD: "test-password" POSTGRES_PORT: "5432" POSTGRES_USER: "postgres" + SENTRY_DSN: "https://sentry.test.com" --- # Source: ercs-backend-helm/charts/app/charts/minio/templates/provisioning-configmap.yaml @@ -256,6 +257,7 @@ data: CSRF_COOKIE_DOMAIN: ".example.com" DJANGO_DEBUG: "false" FRONTEND_DOMAIN: "https://ercs-frontend.test.com" + SENTRY_ENABLED: "false" SESSION_COOKIE_DOMAIN: ".example.com" --- @@ -561,8 +563,8 @@ spec: template: metadata: annotations: - checksum/secret: 9323ef98ced6d9a505d3f0c1e990e52e7df25cb26d497b22d6150a5c6eb76abb - checksum/configmap: 6ba5453622d2a176dcdcf3399bdffaa20a6a38105a9e6a0654a92baa1a0da3fd + checksum/secret: e77f1403534ce3ff6cd39b1662c58f90d38491605f9729a6986ce723a0aad6ed + checksum/configmap: 287a079f9e9782396ed4d04a5aeba0aff708103af9eebda1d1bf1b21da310e7b labels: app: release-name-app component: api @@ -616,8 +618,8 @@ spec: template: metadata: annotations: - checksum/secret: 9323ef98ced6d9a505d3f0c1e990e52e7df25cb26d497b22d6150a5c6eb76abb - checksum/configmap: 6ba5453622d2a176dcdcf3399bdffaa20a6a38105a9e6a0654a92baa1a0da3fd + checksum/secret: e77f1403534ce3ff6cd39b1662c58f90d38491605f9729a6986ce723a0aad6ed + checksum/configmap: 287a079f9e9782396ed4d04a5aeba0aff708103af9eebda1d1bf1b21da310e7b labels: app: release-name-app component: worker-beat @@ -675,8 +677,8 @@ spec: template: metadata: annotations: - checksum/secret: 9323ef98ced6d9a505d3f0c1e990e52e7df25cb26d497b22d6150a5c6eb76abb - checksum/configmap: 6ba5453622d2a176dcdcf3399bdffaa20a6a38105a9e6a0654a92baa1a0da3fd + checksum/secret: e77f1403534ce3ff6cd39b1662c58f90d38491605f9729a6986ce723a0aad6ed + checksum/configmap: 287a079f9e9782396ed4d04a5aeba0aff708103af9eebda1d1bf1b21da310e7b labels: app: release-name-app component: worker @@ -913,8 +915,8 @@ spec: template: metadata: annotations: - checksum/secret: 9323ef98ced6d9a505d3f0c1e990e52e7df25cb26d497b22d6150a5c6eb76abb - checksum/configmap: 6ba5453622d2a176dcdcf3399bdffaa20a6a38105a9e6a0654a92baa1a0da3fd + checksum/secret: e77f1403534ce3ff6cd39b1662c58f90d38491605f9729a6986ce723a0aad6ed + checksum/configmap: 287a079f9e9782396ed4d04a5aeba0aff708103af9eebda1d1bf1b21da310e7b labels: app: release-name-app component: argo-hooks @@ -956,8 +958,8 @@ spec: template: metadata: annotations: - checksum/secret: 9323ef98ced6d9a505d3f0c1e990e52e7df25cb26d497b22d6150a5c6eb76abb - checksum/configmap: 6ba5453622d2a176dcdcf3399bdffaa20a6a38105a9e6a0654a92baa1a0da3fd + checksum/secret: e77f1403534ce3ff6cd39b1662c58f90d38491605f9729a6986ce723a0aad6ed + checksum/configmap: 287a079f9e9782396ed4d04a5aeba0aff708103af9eebda1d1bf1b21da310e7b labels: app: release-name-app component: argo-hooks diff --git a/helm/tests/alpha.yaml b/helm/tests/alpha.yaml index 69bf334..b5c294d 100644 --- a/helm/tests/alpha.yaml +++ b/helm/tests/alpha.yaml @@ -43,3 +43,4 @@ app: DJANGO_SECRET_KEY: "django-secret-key" CELERY_REDIS_URL: "redis://redis:6379/0" CACHE_REDIS_URL: "redis://redis:6379/1" + SENTRY_DSN: "https://sentry.test.com" diff --git a/helm/values.yaml b/helm/values.yaml index ef31f30..7b69bf2 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -151,6 +151,8 @@ app: FRONTEND_DOMAIN: "{{ required \".app.env.FRONTEND_DOMAIN\" nil }}" SESSION_COOKIE_DOMAIN: "{{ required \".app.env.SESSION_COOKIE_DOMAIN\" nil }}" CSRF_COOKIE_DOMAIN: "{{ required \".app.env.CSRF_COOKIE_DOMAIN\" nil }}" + # Sentry + SENTRY_ENABLED: "false" secrets: DJANGO_SECRET_KEY: "{{ required \".Values.secrets.DJANGO_SECRET_KEY\" nil }}" @@ -169,3 +171,5 @@ app: # Redis CELERY_REDIS_URL: "redis://{{ printf \"%s-master\" (include \"common.names.fullname\" $.Subcharts.redis) }}:6379/0" CACHE_REDIS_URL: "redis://{{ printf \"%s-master\" (include \"common.names.fullname\" $.Subcharts.redis) }}:6379/1" + # sentry + SENTRY_DSN: "{{ required \".app.secrets.SENTRY_DSN\" nil }}" diff --git a/schema.graphql b/schema.graphql index 7d400de..fe0c569 100644 --- a/schema.graphql +++ b/schema.graphql @@ -130,6 +130,7 @@ input CapacityAndResourceCreateInput { input CapacityAndResourceFilter { id: ID isActive: Boolean + title: StrFilterLookup AND: CapacityAndResourceFilter OR: CapacityAndResourceFilter NOT: CapacityAndResourceFilter @@ -1034,7 +1035,7 @@ type ReportType { iframeUrl: String visibility: ReportVisibility! reportType: ReportTypeEnum! - thematicAreaId: ID! + thematicAreaId: ID regionId: ID disasterType: String owner: String