mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 16:31:15 -05:00
- Refactor v2 post_notification to use a single method for sms and email.
- Added the `simulate` notification logic to version 2. We have 3 email addresses and phone numbers that are used to simulate a successful post to /notifications. This was missed out of the version 2 endpoint. - Added a test to template_dao to check for the default value of normal for new templates - in v2 get_notifications, casted the path param to a uuid, if not uuid abort(404)
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import uuid
|
||||
|
||||
from flask import jsonify, request, url_for
|
||||
from werkzeug.exceptions import abort
|
||||
|
||||
from app import api_user
|
||||
from app.dao import notifications_dao
|
||||
from app.schema_validation import validate
|
||||
@@ -6,10 +10,14 @@ from app.v2.notifications import notification_blueprint
|
||||
from app.v2.notifications.notification_schemas import get_notifications_request
|
||||
|
||||
|
||||
@notification_blueprint.route("/<uuid:id>", methods=['GET'])
|
||||
@notification_blueprint.route("/<id>", methods=['GET'])
|
||||
def get_notification_by_id(id):
|
||||
try:
|
||||
casted_id = uuid.UUID(id)
|
||||
except ValueError:
|
||||
abort(404)
|
||||
notification = notifications_dao.get_notification_with_personalisation(
|
||||
str(api_user.service_id), id, key_type=None
|
||||
api_user.service_id, casted_id, key_type=None
|
||||
)
|
||||
|
||||
return jsonify(notification.serialize()), 200
|
||||
|
||||
Reference in New Issue
Block a user