Files

61 lines
2.0 KiB
Python
Raw Permalink Normal View History

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 = {
2022-04-08 17:05:59 +01:00
'$schema': 'http://json-schema.org/draft-07/schema#',
2020-07-07 11:42:38 +01:00
'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'},
'starts_at': {'type': 'string', 'format': 'datetime'},
'finishes_at': {'type': 'string', 'format': 'datetime'},
2021-08-27 13:22:54 +01:00
'areas': {'type': 'object'},
'content': {'type': 'string', 'minLength': 1},
2021-01-15 14:43:40 +00:00
'reference': {'type': 'string', 'minLength': 1, 'maxLength': 255},
2020-07-07 11:42:38 +01: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']},
]},
],
2020-07-07 11:42:38 +01:00
'additionalProperties': False
}
update_broadcast_message_schema = {
2022-04-08 17:05:59 +01:00
'$schema': 'http://json-schema.org/draft-07/schema#',
2020-07-07 11:42:38 +01:00
'description': 'POST update broadcast_message schema',
'type': 'object',
'title': 'Update broadcast_message',
'properties': {
'personalisation': {'type': 'object'},
'starts_at': {'type': 'string', 'format': 'datetime'},
'finishes_at': {'type': 'string', 'format': 'datetime'},
2021-08-27 13:22:54 +01:00
'areas': {'type': 'object'},
2020-07-07 11:42:38 +01:00
},
'required': [],
'additionalProperties': False
}
update_broadcast_message_status_schema = {
2022-04-08 17:05:59 +01:00
'$schema': 'http://json-schema.org/draft-07/schema#',
2020-07-07 11:42:38 +01:00
'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
}