Skip to content

Commit f64852c

Browse files
committed
Fixed notifications api not turned into a dict when returned as json
1 parent 9d24e93 commit f64852c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

backend/PyMatcha/routes/api/notifications.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
@notifications_bp.route("/notifications", methods=["GET"])
1414
@jwt_required
1515
def get_all_notifications():
16-
return SuccessOutput("notifications", current_user.get_all_notifications())
16+
all_notifications = [notif.to_dict() for notif in current_user.get_all_notifications()]
17+
return SuccessOutput("notifications", all_notifications)
1718

1819

1920
@notifications_bp.route("/notifications/unread", methods=["GET"])
2021
@jwt_required
2122
def get_unread_notifications():
22-
return SuccessOutput("notifications", current_user.get_unread_notifications())
23+
unread_notifications = [notif.to_dict() for notif in current_user.get_unread_notifications()]
24+
return SuccessOutput("notifications", unread_notifications)
2325

2426

2527
@notifications_bp.route("/notifications/read/<n_id>", methods=["POST"])

0 commit comments

Comments
 (0)