mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-28 11:49:42 -04:00
Create new column in notifications and notification_history to store the client_reference because I remembered that reference is used for email providers.
This commit is contained in:
@@ -519,6 +519,7 @@ class Notification(db.Model):
|
||||
onupdate=datetime.datetime.utcnow)
|
||||
status = db.Column(NOTIFICATION_STATUS_TYPES_ENUM, index=True, nullable=False, default='created')
|
||||
reference = db.Column(db.String, nullable=True, index=True)
|
||||
client_reference = db.Column(db.String, index=True, nullable=True)
|
||||
_personalisation = db.Column(db.String, nullable=True)
|
||||
|
||||
template_history = db.relationship('TemplateHistory', primaryjoin=and_(
|
||||
@@ -561,6 +562,7 @@ class NotificationHistory(db.Model):
|
||||
updated_at = db.Column(db.DateTime, index=False, unique=False, nullable=True)
|
||||
status = db.Column(NOTIFICATION_STATUS_TYPES_ENUM, index=True, nullable=False, default='created')
|
||||
reference = db.Column(db.String, nullable=True, index=True)
|
||||
client_reference = db.Column(db.String, nullable=True)
|
||||
|
||||
@classmethod
|
||||
def from_notification(cls, notification):
|
||||
|
||||
@@ -60,7 +60,7 @@ def persist_notification(template_id,
|
||||
created_at=created_at or datetime.utcnow().strftime(DATETIME_FORMAT),
|
||||
job_id=job_id,
|
||||
job_row_number=job_row_number,
|
||||
reference=reference
|
||||
client_reference=reference
|
||||
)
|
||||
dao_create_notification(notification)
|
||||
return notification
|
||||
|
||||
@@ -101,7 +101,7 @@ post_email_response = {
|
||||
|
||||
def create_post_sms_response_from_notification(notification, body, from_number, url_root):
|
||||
return {"id": notification.id,
|
||||
"reference": notification.reference,
|
||||
"reference": notification.client_reference,
|
||||
"content": {'body': body,
|
||||
'from_number': from_number},
|
||||
"uri": "{}/v2/notifications/{}".format(url_root, str(notification.id)),
|
||||
@@ -112,7 +112,7 @@ def create_post_sms_response_from_notification(notification, body, from_number,
|
||||
def create_post_email_response_from_notification(notification, content, subject, email_from, url_root):
|
||||
return {
|
||||
"id": notification.id,
|
||||
"reference": notification.reference,
|
||||
"reference": notification.client_reference,
|
||||
"content": {
|
||||
"from_email": email_from,
|
||||
"body": content,
|
||||
|
||||
Reference in New Issue
Block a user