mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 17:31:14 -05:00
Included reference when persisting the notification.
This was already part of the data model. Not included in the send_sms|email task because there is no reference from the job.
This commit is contained in:
@@ -46,7 +46,8 @@ def persist_notification(template_id,
|
||||
key_type,
|
||||
created_at=None,
|
||||
job_id=None,
|
||||
job_row_number=None):
|
||||
job_row_number=None,
|
||||
reference=None):
|
||||
notification = Notification(
|
||||
template_id=template_id,
|
||||
template_version=template_version,
|
||||
@@ -56,9 +57,10 @@ def persist_notification(template_id,
|
||||
notification_type=notification_type,
|
||||
api_key_id=api_key_id,
|
||||
key_type=key_type,
|
||||
created_at=created_at if created_at else datetime.utcnow().strftime(DATETIME_FORMAT),
|
||||
created_at=created_at or datetime.utcnow().strftime(DATETIME_FORMAT),
|
||||
job_id=job_id,
|
||||
job_row_number=job_row_number
|
||||
job_row_number=job_row_number,
|
||||
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": None, # not yet implemented
|
||||
"reference": notification.reference,
|
||||
"content": {'body': body,
|
||||
'from_number': from_number},
|
||||
"uri": "{}/v2/notifications/{}".format(url_root, str(notification.id)),
|
||||
|
||||
@@ -37,7 +37,8 @@ def post_sms_notification():
|
||||
personalisation=form.get('personalisation', None),
|
||||
notification_type=SMS_TYPE,
|
||||
api_key_id=api_user.id,
|
||||
key_type=api_user.key_type)
|
||||
key_type=api_user.key_type,
|
||||
reference=form['reference'])
|
||||
send_notification_to_queue(notification, service.research_mode)
|
||||
|
||||
resp = create_post_sms_response_from_notification(notification,
|
||||
@@ -63,7 +64,8 @@ def post_email_notification():
|
||||
personalisation=form.get('personalisation', None),
|
||||
notification_type=EMAIL_TYPE,
|
||||
api_key_id=api_user.id,
|
||||
key_type=api_user.key_type)
|
||||
key_type=api_user.key_type,
|
||||
reference=form['reference'])
|
||||
|
||||
send_notification_to_queue(notification, service.research_mode)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user