2018-11-02 16:00:22 +00:00
|
|
|
from app.models import (
|
|
|
|
|
TEMPLATE_PROCESS_TYPE,
|
|
|
|
|
TEMPLATE_TYPES,
|
|
|
|
|
)
|
|
|
|
|
from app.schema_validation.definitions import uuid
|
|
|
|
|
|
|
|
|
|
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"},
|
|
|
|
|
"template_type": {"enum": TEMPLATE_TYPES},
|
|
|
|
|
"service": uuid,
|
|
|
|
|
"process_type": {"emun": TEMPLATE_PROCESS_TYPE},
|
|
|
|
|
"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,
|
2020-06-09 11:02:22 +01:00
|
|
|
"postage": {"type": "string", "format": "postage"},
|
2018-11-02 16:00:22 +00:00
|
|
|
},
|
|
|
|
|
"if": {
|
|
|
|
|
"properties": {
|
|
|
|
|
"template_type": {"enum": ["email", "letter"]}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"then": {"required": ["subject"]},
|
|
|
|
|
"required": ["name", "template_type", "content", "service", "created_by"]
|
|
|
|
|
}
|