notify-admin-768 initial

This commit is contained in:
Kenneth Kehl
2023-09-21 13:50:36 -07:00
parent dc530949c9
commit 141deb3880
2 changed files with 10 additions and 2 deletions

View File

@@ -31,6 +31,7 @@ from app.models import (
)
from app.notifications.process_notifications import persist_notification
from app.notifications.validators import check_service_over_total_message_limit
from app.schema_validation.definitions import uuid
from app.serialised_models import SerialisedService, SerialisedTemplate
from app.service.utils import service_allowed_to_send_to
from app.utils import DATETIME_FORMAT
@@ -193,6 +194,12 @@ def save_sms(self, service_id, notification_id, encrypted_notification, sender_i
return
try:
job_id = notification.get("job", None)
created_by_id = None
if job_id:
job = dao_get_job_by_id(job_id)
created_by_id = job.created_by_id
saved_notification = persist_notification(
template_id=notification["template"],
template_version=notification["template_version"],
@@ -203,6 +210,7 @@ def save_sms(self, service_id, notification_id, encrypted_notification, sender_i
api_key_id=None,
key_type=KEY_TYPE_NORMAL,
created_at=datetime.utcnow(),
created_by_id=uuid.UUID(created_by_id),
job_id=notification.get("job", None),
job_row_number=notification.get("row_number", None),
notification_id=notification_id,