Skip to content

Commit

Permalink
update schema of templates
Browse files Browse the repository at this point in the history
  • Loading branch information
devketanpro committed Jan 31, 2024
1 parent 41aceeb commit f9d07f1
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion server/planning/events/events_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,61 @@ class EventsTemplateResource(Resource):
endpoint_name = "events_template"
resource_methods = ["GET", "POST"]
item_methods = ["GET", "DELETE", "PATCH", "PUT"]

privileges = {
"GET": "planning_event_management",
"POST": "planning_event_templates",
"DELETE": "planning_event_templates",
"PATCH": "planning_event_templates",
"PUT": "planning_event_templates",
}
_event_fields = {
"slugline": {"type": "string", "required": False, "readonly": True},
"name": {"type": "string", "required": False, "readonly": True},
"definition_short": {"type": "string", "required": False, "readonly": True},
"definition_long": {"type": "string", "required": False, "readonly": True},
"internal_note": {"type": "string", "required": False, "readonly": True},
"ednote": {"type": "string", "required": False, "readonly": True},
"links": {"type": "list", "readonly": True},
"occur_status": {
"type": "dict",
"allow_unknown": True,
"schema": {
"qcode": {"type": "string"},
"name": {"type": "string"},
"label": {"type": "string"},
},
"readonly": True,
},
"files": {
"type": "list",
"schema": Resource.rel("events_files"),
"readonly": True,
},
"calendars": {
"type": "list",
"schema": {
"type": "dict",
"allow_unknown": True,
"schema": {
"qcode": {"type": "string"},
"name": {"type": "string"},
"is_active": {"type": "boolean"},
},
},
"readonly": True,
},
"location": {"type": "list", "schema": {"type": "dict"}, "readonly": True},
"event_contact_info": {
"type": "list",
"schema": Resource.rel("contacts"),
"readonly": True,
},
"subject": {"type": "list", "schema": {"type": "dict"}, "readonly": True},
}
# add embedded_planning in the templates data schema
_event_fields.setdefault("embedded_planning", events_schema["embedded_planning"])

schema = {
"template_name": {
"type": "string",
Expand All @@ -52,7 +100,7 @@ class EventsTemplateResource(Resource):
embeddable=False,
required=True,
),
"data": {"type": "dict", "schema": events_schema},
"data": {"type": "dict", "schema": _event_fields, "allow_unknown": True},
}


Expand Down

0 comments on commit f9d07f1

Please sign in to comment.