Notification_type is a required parameter, admin app always passes it in.

Normalise for notificaiton type.
Throw InvalidRequest exception is the notification type is invalid.
This commit is contained in:
Rebecca Law
2018-03-07 18:13:40 +00:00
committed by Chris Hill-Scott
parent 5f25fc0db4
commit e3a75d1b7d
4 changed files with 62 additions and 46 deletions

View File

@@ -385,7 +385,12 @@ def get_notification_for_service(service_id, notification_id):
def search_for_notification_by_to_field(service_id, search_term, statuses, notification_type):
results = notifications_dao.dao_get_notifications_by_to_field(service_id, search_term, statuses, notification_type)
results = notifications_dao.dao_get_notifications_by_to_field(
service_id=service_id,
search_term=search_term,
statuses=statuses,
notification_type=notification_type
)
return jsonify(
notifications=notification_with_template_schema.dump(results, many=True).data
), 200