Update notification status by message reference

- SES sends a reference to allow us to identify the notification
- use this to update status

If source of email is one of our internal emails (invites or validations) - don't try and update a notification.
This commit is contained in:
Martyn Inglis
2016-03-11 10:19:40 +00:00
parent 901d04605f
commit 62a7b8bcd0
5 changed files with 92 additions and 35 deletions

View File

@@ -80,20 +80,9 @@ def update_notification_status_by_id(notification_id, status):
return count
def update_notification_status_by_to(to, status):
count = db.session.query(Notification).filter_by(
to=to
).update({
Notification.status: status,
Notification.updated_at: datetime.utcnow()
})
db.session.commit()
return count
def update_notification_status_by_reference(reference, status):
count = db.session.query(Notification).filter_by(
refernce=reference
reference=reference
).update({
Notification.status: status,
Notification.updated_at: datetime.utcnow()