mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -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 import notifications_dao
|
||||||
from app.dao.notifications_dao import (
|
from app.dao.notifications_dao import (
|
||||||
sanitize_successful_notification_by_id,
|
sanitize_successful_notification_by_id,
|
||||||
|
update_notification_message_id,
|
||||||
update_notification_status_by_id,
|
update_notification_status_by_id,
|
||||||
)
|
)
|
||||||
from app.delivery import send_to_providers
|
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
|
# Code branches off to send_to_providers.py
|
||||||
message_id = send_to_providers.send_sms_to_provider(notification)
|
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
|
# 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)
|
# 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)
|
my_eta = utc_now() + timedelta(seconds=DELIVERY_RECEIPT_DELAY_IN_SECONDS)
|
||||||
|
|||||||
@@ -110,6 +110,16 @@ def _update_notification_status(
|
|||||||
return notification
|
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
|
@autocommit
|
||||||
def update_notification_status_by_id(
|
def update_notification_status_by_id(
|
||||||
notification_id, status, sent_by=None, provider_response=None, carrier=None
|
notification_id, status, sent_by=None, provider_response=None, carrier=None
|
||||||
|
|||||||
Reference in New Issue
Block a user