send broadcast events rather than messages

use the new endpoint from cbc proxy. create a new task that just
serializes the event and sends it across rather than sending a template
and the broadcast message.

some changes to serialize to make it json friendly etc. it also expects
sent_at and transmitted_finishes_at to always be set (we set them in the
code but don't enforce it n the DB right now), as they're required by
utils template. not sure whether we'll update db constraints to be more
strict or utils template to be more permissive just yet, wait until we
find out more about the requirements of the CBCs we integrate with.
This commit is contained in:
Leo Hemsted
2020-08-04 19:21:22 +01:00
parent 1c48e2efb2
commit bdf2253298
7 changed files with 138 additions and 44 deletions

View File

@@ -24,6 +24,10 @@ def dao_get_broadcast_message_by_id(broadcast_message_id):
return BroadcastMessage.query.get(broadcast_message_id)
def dao_get_broadcast_event_by_id(broadcast_event_id):
return BroadcastEvent.query.get(broadcast_event_id)
def dao_get_broadcast_messages_for_service(service_id):
return BroadcastMessage.query.filter(
BroadcastMessage.service_id == service_id