Skip to content

Commit

Permalink
CM-830: access basic data about grievances (for example number of gri…
Browse files Browse the repository at this point in the history
…evances) (#18)

* CM-830: added grievance for opensearch reporting layer

* CM-830: removed processing json ext
  • Loading branch information
sniedzielski authored Jun 10, 2024
1 parent 24b06d2 commit eadeb27
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions grievance_social_protection/documents.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from django.apps import apps

# Check if the 'opensearch_reports' app is in INSTALLED_APPS
if 'opensearch_reports' in apps.app_configs:
from django_opensearch_dsl import Document, fields as opensearch_fields
from django_opensearch_dsl.registries import registry
from grievance_social_protection.models import Ticket

@registry.register_document
class TicketDocument(Document):
key = opensearch_fields.KeywordField(),
title = opensearch_fields.KeywordField(),

description = opensearch_fields.KeywordField(),
code = opensearch_fields.KeywordField(),
attending_staff = opensearch_fields.KeywordField(),
status = opensearch_fields.KeywordField(),

category = opensearch_fields.KeywordField(),
flags = opensearch_fields.KeywordField(),
channel = opensearch_fields.KeywordField(),
resolution = opensearch_fields.KeywordField(),

class Index:
name = 'ticket'
settings = {
'number_of_shards': 1,
'number_of_replicas': 0
}
auto_refresh = True

class Django:
model = Ticket
fields = [
'id', 'key', 'title', 'code'
]
queryset_pagination = 5000

0 comments on commit eadeb27

Please sign in to comment.