Add private endpoint to get notification by ID

We need this for the two way stuff in the admin app.

We already have this as a public endpoint, but the admin app can’t use
it, because the admin app auths with its own key, not that of the
service it’s acting on behalf of.

This endpoint makes sure that a request originating from one service
can’t be used to see notifications belonging to another service.
This commit is contained in:
Chris Hill-Scott
2017-06-06 16:21:57 +01:00
parent 43aade9ab5
commit 635fb8fe44
2 changed files with 46 additions and 0 deletions

View File

@@ -300,6 +300,19 @@ def get_all_notifications_for_service(service_id):
), 200
@service_blueprint.route('/<uuid:service_id>/notifications/<uuid:notification_id>', methods=['GET'])
def get_notification_for_service(service_id, notification_id):
notification = notifications_dao.get_notification_with_personalisation(
service_id,
notification_id,
key_type=None,
)
return jsonify(
notification_with_template_schema.dump(notification).data,
), 200
def search_for_notification_by_to_field(service_id, search_term, statuses):
results = notifications_dao.dao_get_notifications_by_to_field(service_id, search_term, statuses)
return jsonify(