mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 18:31:13 -05:00
remove jobs from letter api and make success/error ftp callback tasks
1. No longer create jobs when creating letters from api 🎉
2. Bulk update notifications based on the notification references after
we send them to DVLA - either as success or as error
This commit is contained in:
@@ -475,15 +475,19 @@ def dao_update_notifications_for_job_to_sent_to_dvla(job_id, provider):
|
||||
|
||||
@statsd(namespace="dao")
|
||||
@transactional
|
||||
def dao_update_notifications_by_reference_sent_to_dvla(notification_references, provider):
|
||||
def dao_update_notifications_by_reference(references, update_dict):
|
||||
now = datetime.utcnow()
|
||||
updated_count = db.session.query(
|
||||
Notification).filter(Notification.job_id == job_id).update(
|
||||
{'status': NOTIFICATION_SENDING, "sent_by": provider, "sent_at": now})
|
||||
updated_count = Notification.query().filter(
|
||||
Notification.reference.in_(references)
|
||||
).update(
|
||||
update_dict
|
||||
)
|
||||
|
||||
db.session.query(
|
||||
NotificationHistory).filter(NotificationHistory.job_id == job_id).update(
|
||||
{'status': NOTIFICATION_SENDING, "sent_by": provider, "sent_at": now, "updated_at": now})
|
||||
NotificationHistory.query().filter(
|
||||
NotificationHistory.reference.in_(references)
|
||||
).update(
|
||||
update_dict
|
||||
)
|
||||
|
||||
return updated_count
|
||||
|
||||
|
||||
Reference in New Issue
Block a user