diff --git a/app/api/views/notification.py b/app/api/views/notification.py index 67013147..d71856cc 100644 --- a/app/api/views/notification.py +++ b/app/api/views/notification.py @@ -22,6 +22,7 @@ def get_notifications(): - notifications: list of notifications. - id - message + - title - read - created_at """ @@ -48,6 +49,7 @@ def get_notifications(): { "id": notification.id, "message": notification.message, + "title": notification.title, "read": notification.read, "created_at": notification.created_at.humanize(), } diff --git a/docs/api.md b/docs/api.md index 45f82efd..969c077c 100644 --- a/docs/api.md +++ b/docs/api.md @@ -820,6 +820,7 @@ Output: - notifications: list of notification, each notification has: - id - message: the message in html + - title: the message title - read: whether the user has read the notification - created_at: when the notification is created diff --git a/tests/api/test_notification.py b/tests/api/test_notification.py index 26f17195..d1c8faed 100644 --- a/tests/api/test_notification.py +++ b/tests/api/test_notification.py @@ -20,7 +20,7 @@ def test_get_notifications(flask_client): Session.commit() r = flask_client.get( - url_for("api.get_notifications", page=0), + "/api/notifications?page=0", headers={"Authentication": api_key.code}, ) @@ -30,6 +30,7 @@ def test_get_notifications(flask_client): for n in r.json["notifications"]: assert n["id"] > 0 assert n["message"] + assert "title" in n assert n["read"] is False assert n["created_at"]