mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
- Implemented persist_notification and send_notification_to_queue in the process_notifications module
- Not sure I want to create a new classmethod on Notifications to create from v2 request. Will take another look at that.
This commit is contained in:
@@ -22,7 +22,7 @@ from app.authentication.utils import get_secret
|
||||
from app import (
|
||||
db,
|
||||
encryption,
|
||||
DATETIME_FORMAT)
|
||||
DATETIME_FORMAT, create_uuid)
|
||||
|
||||
from app.history_meta import Versioned
|
||||
|
||||
@@ -562,6 +562,30 @@ class Notification(db.Model):
|
||||
key_type=key_type
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_v2_api_request(cls,
|
||||
template_id,
|
||||
template_version,
|
||||
recipient,
|
||||
service_id,
|
||||
personalisation,
|
||||
notification_type,
|
||||
api_key_id,
|
||||
key_type):
|
||||
return cls(
|
||||
id=create_uuid(),
|
||||
template_id=template_id,
|
||||
template_version=template_version,
|
||||
to=recipient,
|
||||
service_id=service_id,
|
||||
status='created',
|
||||
created_at=datetime.datetime.strftime(datetime.datetime.utcnow(), DATETIME_FORMAT),
|
||||
personalisation=personalisation,
|
||||
notification_type=notification_type,
|
||||
api_key_id=api_key_id,
|
||||
key_type=key_type
|
||||
)
|
||||
|
||||
|
||||
class NotificationHistory(db.Model):
|
||||
__tablename__ = 'notification_history'
|
||||
|
||||
Reference in New Issue
Block a user