mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-08 04:48:24 -04:00
Merge branch 'main' of https://github.com/GSA/notifications-api into notify-233b
This commit is contained in:
@@ -43,6 +43,10 @@ def dao_get_job_by_service_id_and_job_id(service_id, job_id):
|
||||
return Job.query.filter_by(service_id=service_id, id=job_id).one()
|
||||
|
||||
|
||||
def dao_get_unfinished_jobs():
|
||||
return Job.query.filter(Job.processing_finished.is_(None)).all()
|
||||
|
||||
|
||||
def dao_get_jobs_by_service_id(
|
||||
service_id,
|
||||
*,
|
||||
|
||||
@@ -95,7 +95,7 @@ def _update_notification_status(notification, status, provider_response=None):
|
||||
|
||||
|
||||
@autocommit
|
||||
def update_notification_status_by_id(notification_id, status, sent_by=None):
|
||||
def update_notification_status_by_id(notification_id, status, sent_by=None, provider_response=None):
|
||||
notification = Notification.query.with_for_update().filter(Notification.id == notification_id).first()
|
||||
|
||||
if not notification:
|
||||
@@ -121,6 +121,8 @@ def update_notification_status_by_id(notification_id, status, sent_by=None):
|
||||
and not country_records_delivery(notification.phone_prefix)
|
||||
):
|
||||
return None
|
||||
if provider_response:
|
||||
notification.provider_response = provider_response
|
||||
if not notification.sent_by and sent_by:
|
||||
notification.sent_by = sent_by
|
||||
return _update_notification_status(
|
||||
|
||||
Reference in New Issue
Block a user