diff --git a/backoffice/backoffice/workflows/api/views.py b/backoffice/backoffice/workflows/api/views.py index 158f3643..c42b1e76 100644 --- a/backoffice/backoffice/workflows/api/views.py +++ b/backoffice/backoffice/workflows/api/views.py @@ -2,11 +2,13 @@ from django.shortcuts import get_object_or_404 from django_elasticsearch_dsl_drf.filter_backends import ( + FacetedSearchFilterBackend, FilteringFilterBackend, OrderingFilterBackend, SearchFilterBackend, ) from django_elasticsearch_dsl_drf.viewsets import BaseDocumentViewSet +from opensearch_dsl import TermsFacet from rest_framework import status, viewsets from rest_framework.decorators import action from rest_framework.response import Response @@ -143,6 +145,7 @@ def __init__(self, *args, **kwargs): pagination_class = OSStandardResultsSetPagination filter_backends = [ SearchFilterBackend, + FacetedSearchFilterBackend, FilteringFilterBackend, OrderingFilterBackend, ] @@ -158,5 +161,19 @@ def __init__(self, *args, **kwargs): ordering = ["-_updated_at"] + faceted_search_fields = { + "status": { + "field": "status", + "facet": TermsFacet, + "options": { + "size": 15, + "order": { + "_key": "asc", + }, + }, + "enabled": True, + } + } + def get_serializer_class(self): return WorkflowDocumentSerializer diff --git a/workflows/logs/scheduler/latest b/workflows/logs/scheduler/latest index 7de2e9aa..2e2f43b7 120000 --- a/workflows/logs/scheduler/latest +++ b/workflows/logs/scheduler/latest @@ -1 +1 @@ -2024-07-26 \ No newline at end of file +2024-07-30 \ No newline at end of file