2024-01-16 07:37:21 -05:00
|
|
|
from app.enums import TemplateProcessType, TemplateType
|
2020-06-09 17:44:09 +01:00
|
|
|
from app.schema_validation.definitions import nullable_uuid, uuid
|
2018-11-02 16:00:22 +00:00
|
|
|
|
|
|
|
|
post_create_template_schema = {
|
|
|
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
|
|
|
"description": "POST create new template",
|
|
|
|
|
"type": "object",
|
|
|
|
|
"title": "payload for POST /service/<uuid:service_id>/template",
|
|
|
|
|
"properties": {
|
|
|
|
|
"name": {"type": "string"},
|
2024-02-21 12:35:18 -05:00
|
|
|
"template_type": {"enum": list(TemplateType)},
|
2018-11-02 16:00:22 +00:00
|
|
|
"service": uuid,
|
2024-02-21 12:35:18 -05:00
|
|
|
"process_type": {"enum": list(TemplateProcessType)},
|
2018-11-02 16:00:22 +00:00
|
|
|
"content": {"type": "string"},
|
|
|
|
|
"subject": {"type": "string"},
|
2018-11-05 10:54:42 +00:00
|
|
|
"created_by": uuid,
|
2018-12-17 10:03:54 +00:00
|
|
|
"parent_folder_id": uuid,
|
2018-11-02 16:00:22 +00:00
|
|
|
},
|
2024-02-21 12:35:18 -05:00
|
|
|
"if": {"properties": {"template_type": {"enum": [TemplateType.EMAIL]}}},
|
2018-11-02 16:00:22 +00:00
|
|
|
"then": {"required": ["subject"]},
|
2023-08-29 14:54:30 -07:00
|
|
|
"required": ["name", "template_type", "content", "service", "created_by"],
|
2018-11-02 16:00:22 +00:00
|
|
|
}
|
2020-06-09 17:44:09 +01:00
|
|
|
|
|
|
|
|
post_update_template_schema = {
|
|
|
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
|
|
|
"description": "POST update existing template",
|
|
|
|
|
"type": "object",
|
|
|
|
|
"title": "payload for POST /service/<uuid:service_id>/template/<uuid:template_id>",
|
|
|
|
|
"properties": {
|
|
|
|
|
"id": uuid,
|
|
|
|
|
"name": {"type": "string"},
|
2024-02-21 12:35:18 -05:00
|
|
|
"template_type": {"enum": list(TemplateType)},
|
2020-06-09 17:44:09 +01:00
|
|
|
"service": uuid,
|
2024-02-21 12:35:18 -05:00
|
|
|
"process_type": {"enum": list(TemplateProcessType)},
|
2020-06-09 17:44:09 +01:00
|
|
|
"content": {"type": "string"},
|
|
|
|
|
"subject": {"type": "string"},
|
|
|
|
|
"reply_to": nullable_uuid,
|
|
|
|
|
"created_by": uuid,
|
|
|
|
|
"archived": {"type": "boolean"},
|
2023-08-29 14:54:30 -07:00
|
|
|
"current_user": uuid,
|
2020-06-09 17:44:09 +01:00
|
|
|
},
|
|
|
|
|
}
|