mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user