mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 08:21:13 -05:00
add send_broadcast_message task
task takes a brodcast_message_id, and makes a post to the cbc-proxy for now, hardcode the url to the notify stub. the stub requires template as the admin/api get it, so use the marshmallow schema to json dump it. Note - this also required us to tweak the BroadcastMessage.serialize function so that it converts uuids in to ids - flask's jsonify function does that for free but requests.post doesn't sadly. if the request fails (either 4xx or 5xx) just raise an exception and let it bubble up for now - in the future we'll add retry logic
This commit is contained in:
@@ -20,6 +20,10 @@ def dao_get_broadcast_message_by_id_and_service_id(broadcast_message_id, service
|
||||
).one()
|
||||
|
||||
|
||||
def dao_get_broadcast_message_by_id(broadcast_message_id):
|
||||
return BroadcastMessage.query.get(broadcast_message_id)
|
||||
|
||||
|
||||
def dao_get_broadcast_messages_for_service(service_id):
|
||||
return BroadcastMessage.query.filter(
|
||||
BroadcastMessage.service_id == service_id
|
||||
|
||||
Reference in New Issue
Block a user