Skip to content

Commit

Permalink
CM-835: added possibility to default configure roles for staff assign…
Browse files Browse the repository at this point in the history
…ment
  • Loading branch information
sniedzielski committed Apr 16, 2024
1 parent df1c7ef commit 24ab99c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
6 changes: 5 additions & 1 deletion grievance_social_protection/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# CRON timedelta: {days},{hours}
DEFAULT_TIME_RESOLUTION = '5,0'


DEFAULT_CFG = {
"default_validations_disabled": False,
"gql_query_tickets_perms": ["123000"],
Expand All @@ -31,6 +30,9 @@
# CRON timedelta: {days},{hours}
"resolution_times": DEFAULT_TIME_RESOLUTION,
"default_resolution": {DEFAULT_STRING: DEFAULT_TIME_RESOLUTION},

"attending_staff_role_ids": [],
"default_attending_staff_role_ids": {DEFAULT_STRING: [1, 2]},
}


Expand All @@ -54,6 +56,8 @@ class TicketConfig(AppConfig):
grievance_anonymized_fields = {}
resolution_times = {}
default_resolution = {}
attending_staff_role_ids = []
default_attending_staff_role_ids = {}

def ready(self):
from core.models import ModuleConfiguration
Expand Down
17 changes: 17 additions & 0 deletions grievance_social_protection/gql_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,16 @@ def resolve_client_mutation_id(self, info):
# return queryset


class AttendingStaffRoleGQLType(ObjectType):
category = graphene.String()
role_ids = graphene.List(graphene.String)


class GrievanceTypeConfigurationGQLType(ObjectType):
grievance_types = graphene.List(graphene.String)
grievance_flags = graphene.List(graphene.String)
grievance_channels = graphene.List(graphene.String)
grievance_category_staff_roles = graphene.List(AttendingStaffRoleGQLType)

def resolve_grievance_types(self, info):
return TicketConfig.grievance_types
Expand All @@ -96,3 +102,14 @@ def resolve_grievance_flags(self, info):

def resolve_grievance_channels(self, info):
return TicketConfig.grievance_channels

def resolve_grievance_category_staff_roles(self, info):
category_staff_role_list = []
for category_key, role_ids in TicketConfig.default_attending_staff_role_ids.items():
category_staff_role = AttendingStaffRoleGQLType(
category=category_key,
role_ids=role_ids
)
category_staff_role_list.append(category_staff_role)

return category_staff_role_list

0 comments on commit 24ab99c

Please sign in to comment.