2020-07-07 11:42:38 +01:00
|
|
|
from app.models import BroadcastStatusType
|
2021-03-10 13:55:06 +00:00
|
|
|
from app.schema_validation.definitions import uuid
|
2020-07-07 11:42:38 +01:00
|
|
|
|
|
|
|
|
create_broadcast_message_schema = {
|
|
|
|
|
'$schema': 'http://json-schema.org/draft-04/schema#',
|
|
|
|
|
'description': 'POST create broadcast_message schema',
|
|
|
|
|
'type': 'object',
|
|
|
|
|
'title': 'Create broadcast_message',
|
|
|
|
|
'properties': {
|
|
|
|
|
'template_id': uuid,
|
|
|
|
|
'service_id': uuid,
|
|
|
|
|
'created_by': uuid,
|
|
|
|
|
'personalisation': {'type': 'object'},
|
2020-07-09 12:59:09 +01:00
|
|
|
'starts_at': {'type': 'string', 'format': 'datetime'},
|
|
|
|
|
'finishes_at': {'type': 'string', 'format': 'datetime'},
|
2020-07-07 11:42:38 +01:00
|
|
|
'areas': {"type": "array", "items": {"type": "string"}},
|
2020-09-02 14:55:23 +01:00
|
|
|
'simple_polygons': {"type": "array", "items": {"type": "array"}},
|
2021-01-15 14:35:23 +00:00
|
|
|
'content': {'type': 'string', 'minLength': 1, 'maxLength': 1395},
|
2021-01-15 14:43:40 +00:00
|
|
|
'reference': {'type': 'string', 'minLength': 1, 'maxLength': 255},
|
2020-07-07 11:42:38 +01:00
|
|
|
},
|
2021-01-15 14:35:23 +00:00
|
|
|
'required': ['service_id', 'created_by'],
|
2021-01-15 14:43:40 +00:00
|
|
|
'allOf': [
|
|
|
|
|
{'oneOf': [
|
|
|
|
|
{'required': ['template_id']},
|
|
|
|
|
{'required': ['content']},
|
|
|
|
|
]},
|
|
|
|
|
{'oneOf': [
|
|
|
|
|
{'required': ['template_id']},
|
|
|
|
|
{'required': ['reference']},
|
|
|
|
|
]},
|
2021-01-15 14:35:23 +00:00
|
|
|
],
|
2020-07-07 11:42:38 +01:00
|
|
|
'additionalProperties': False
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
update_broadcast_message_schema = {
|
|
|
|
|
'$schema': 'http://json-schema.org/draft-04/schema#',
|
|
|
|
|
'description': 'POST update broadcast_message schema',
|
|
|
|
|
'type': 'object',
|
|
|
|
|
'title': 'Update broadcast_message',
|
|
|
|
|
'properties': {
|
|
|
|
|
'personalisation': {'type': 'object'},
|
2020-07-09 12:59:09 +01:00
|
|
|
'starts_at': {'type': 'string', 'format': 'datetime'},
|
|
|
|
|
'finishes_at': {'type': 'string', 'format': 'datetime'},
|
2020-07-07 11:42:38 +01:00
|
|
|
'areas': {"type": "array", "items": {"type": "string"}},
|
2020-09-02 14:55:23 +01:00
|
|
|
'simple_polygons': {"type": "array", "items": {"type": "array"}},
|
2020-07-07 11:42:38 +01:00
|
|
|
},
|
|
|
|
|
'required': [],
|
|
|
|
|
'additionalProperties': False
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
update_broadcast_message_status_schema = {
|
|
|
|
|
'$schema': 'http://json-schema.org/draft-04/schema#',
|
|
|
|
|
'description': 'POST update broadcast_message status schema',
|
|
|
|
|
'type': 'object',
|
|
|
|
|
'title': 'Update broadcast_message',
|
|
|
|
|
'properties': {
|
|
|
|
|
'status': {'type': 'string', 'enum': BroadcastStatusType.STATUSES},
|
|
|
|
|
'created_by': uuid,
|
|
|
|
|
},
|
|
|
|
|
'required': ['status', 'created_by'],
|
|
|
|
|
'additionalProperties': False
|
|
|
|
|
}
|