mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-30 11:18:54 -04:00
Update notification_history table on insert/update of notifications
triggered via calls in dao_create_notification and dao_update_notification - if you don't use those functions (eg update in bulk) you'll have to update the history table yourself!
This commit is contained in:
@@ -409,6 +409,16 @@ class NotificationHistory(db.Model):
|
||||
status = db.Column(NOTIFICATION_STATUS_TYPES_ENUM, nullable=False, default='created')
|
||||
reference = db.Column(db.String, nullable=True, index=True)
|
||||
|
||||
@classmethod
|
||||
def from_notification(cls, notification):
|
||||
from app.schemas import notification_status_schema
|
||||
return cls(notification_status_schema.dump(notification))
|
||||
|
||||
def update_from_notification(self, notification):
|
||||
from app.schemas import notification_status_schema
|
||||
new_notification_schema = cls(notification_status_schema.dump(notification))
|
||||
|
||||
|
||||
|
||||
INVITED_USER_STATUS_TYPES = ['pending', 'accepted', 'cancelled']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user