mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 23:41:17 -05:00
create broadcast_provider_message and use id from that instead
(instead of using the id from broadcast_event) we need every XML blob we send to have a different ID. if we're sending different XML blobs for each provider, then each one should have a different identifier. So, instead of taking the identifier from the broadcast_event, take it from the broadcast_provider_message instead. Note: We're still going to the broadcast_event for most fields, to ensure they stay consistent between different providers. The last thing we want is for different phone networks to get different content
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
from app.models import BroadcastMessage, BroadcastEvent
|
||||
from app import db
|
||||
from app.dao.dao_utils import transactional
|
||||
from app.models import BroadcastMessage, BroadcastEvent, BroadcastProviderMessage, BroadcastProviderMessageStatus
|
||||
|
||||
|
||||
def dao_get_broadcast_message_by_id_and_service_id(broadcast_message_id, service_id):
|
||||
@@ -34,3 +36,14 @@ def get_earlier_events_for_broadcast_event(broadcast_event_id):
|
||||
).order_by(
|
||||
BroadcastEvent.sent_at.asc()
|
||||
).all()
|
||||
|
||||
|
||||
@transactional
|
||||
def create_broadcast_provider_message(broadcast_event, provider):
|
||||
provider_message = BroadcastProviderMessage(
|
||||
broadcast_event=broadcast_event,
|
||||
provider=provider,
|
||||
status=BroadcastProviderMessageStatus.SENDING,
|
||||
)
|
||||
db.session.add(provider_message)
|
||||
return provider_message
|
||||
|
||||
Reference in New Issue
Block a user