cic-internal-integration/apps/cic-notify/cic_notify/tasks/sms/db.py

27 lines
632 B
Python
Raw Normal View History

2021-02-07 03:29:24 +01:00
# standard imports
# third-party imports
import celery
# local imports
from cic_notify.db.models.notification import Notification
from cic_notify.db.enum import NotificationTransportEnum
celery_app = celery.current_app
@celery_app.task
2021-08-29 11:55:47 +02:00
def persist_notification(message, recipient):
2021-02-07 03:29:24 +01:00
"""
:param message:
:type message:
2021-08-29 11:55:47 +02:00
:param recipient:
:type recipient:
2021-02-07 03:29:24 +01:00
:return:
:rtype:
"""
Notification.create_session()
notification = Notification(transport=NotificationTransportEnum.SMS, recipient=recipient, message=message)
Notification.session.add(notification)
Notification.session.commit()