Files
notifications-api/app/v2/notifications/get_notifications.py
Paul Craig 9758b96a2b Create 'v2' get notification route
The new 'v2' API wants to return less data than the previous one,
which was sending back tons of fields the clients never used.

This new route returns only useful information, with the JSON
response dict being built up in the model's `.serialize()` method.

Note that writing the test for this was a bit painful because of
having to treat loads of keys differently. Hopefully we think this
is a good way to write this test, because if we don't, we should
start thinking of a better way to check the values are what we
expect.
2016-11-21 15:41:49 +00:00

23 lines
634 B
Python

from flask import jsonify
from app import api_user
from app.dao import notifications_dao
from app.v2.notifications import notification_blueprint
@notification_blueprint.route("/<uuid:id>", methods=['GET'])
def get_notification_by_id(id):
notification = notifications_dao.get_notification_with_personalisation(
str(api_user.service_id), id, key_type=None
)
return jsonify(notification.serialize()), 200
@notification_blueprint.route("/", methods=['GET'])
def get_notifications():
# validate notifications request arguments
# fetch all notifications
# return notifications_response schema
pass