Add scheduled_for in the post notification request form.

Return scheduled for in get_notification requests.
This commit is contained in:
Rebecca Law
2017-05-15 17:27:38 +01:00
parent 38e5b31e9a
commit f0e2713bef
9 changed files with 151 additions and 46 deletions

View File

@@ -10,8 +10,10 @@ from notifications_utils.recipients import (
from app import redis_store
from app.celery import provider_tasks
from notifications_utils.clients import redis
from app.dao.notifications_dao import dao_create_notification, dao_delete_notifications_and_history_by_id
from app.models import SMS_TYPE, Notification, KEY_TYPE_TEST, EMAIL_TYPE
from app.dao.notifications_dao import (dao_create_notification,
dao_delete_notifications_and_history_by_id,
dao_created_scheduled_notification)
from app.models import SMS_TYPE, Notification, KEY_TYPE_TEST, EMAIL_TYPE, ScheduledNotification
from app.v2.errors import BadRequestError, SendNotificationToQueueError
from app.utils import get_template_instance, cache_key_for_service_template_counter
@@ -120,3 +122,9 @@ def simulated_recipient(to_address, notification_type):
return to_address in formatted_simulated_numbers
else:
return to_address in current_app.config['SIMULATED_EMAIL_ADDRESSES']
def persist_scheduled_notification(notification_id, scheduled_for):
scheduled_notification = ScheduledNotification(notification_id=notification_id,
scheduled_for=scheduled_for)
dao_created_scheduled_notification(scheduled_notification)