mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 15:15:38 -05:00
start writing message ids to the notifications table
This commit is contained in:
@@ -14,6 +14,7 @@ from app.config import Config, QueueNames
|
||||
from app.dao import notifications_dao
|
||||
from app.dao.notifications_dao import (
|
||||
sanitize_successful_notification_by_id,
|
||||
update_notification_message_id,
|
||||
update_notification_status_by_id,
|
||||
)
|
||||
from app.delivery import send_to_providers
|
||||
@@ -128,6 +129,9 @@ def deliver_sms(self, notification_id):
|
||||
)
|
||||
# Code branches off to send_to_providers.py
|
||||
message_id = send_to_providers.send_sms_to_provider(notification)
|
||||
update_notification_message_id(notification_id, message_id)
|
||||
|
||||
# DEPRECATED
|
||||
# We have to put it in UTC. For other timezones, the delay
|
||||
# will be ignored and it will fire immediately (although this probably only affects developer testing)
|
||||
my_eta = utc_now() + timedelta(seconds=DELIVERY_RECEIPT_DELAY_IN_SECONDS)
|
||||
|
||||
@@ -110,6 +110,16 @@ def _update_notification_status(
|
||||
return notification
|
||||
|
||||
|
||||
@autocommit
|
||||
def update_notification_message_id(notification_id, message_id):
|
||||
stmt = (
|
||||
update(Notification)
|
||||
.where(Notification.id == notification_id)
|
||||
.values({"message_id": message_id})
|
||||
)
|
||||
db.session.execute(stmt)
|
||||
|
||||
|
||||
@autocommit
|
||||
def update_notification_status_by_id(
|
||||
notification_id, status, sent_by=None, provider_response=None, carrier=None
|
||||
|
||||
Reference in New Issue
Block a user