Fetch links when gettign user notifications

This commit is contained in:
Peter Vacho 2024-12-29 15:00:25 +01:00
parent 6c9afdbdeb
commit dc18c86057
Signed by: school
GPG key ID: 8CFC3837052871B4

View file

@ -68,7 +68,7 @@ async def get_user_notifications(user_id: PydanticObjectId, user: CurrentUserDep
if user.id != user_id: if user.id != user_id:
raise HTTPException(status.HTTP_403_FORBIDDEN, "You can only access your own notifications.") raise HTTPException(status.HTTP_403_FORBIDDEN, "You can only access your own notifications.")
notifications = await Notification.find(expr(Notification.user).id == user.id).to_list() notifications = await Notification.find(expr(Notification.user).id == user.id, fetch_links=True).to_list()
return [NotificationData.from_notification(notification) for notification in notifications] return [NotificationData.from_notification(notification) for notification in notifications]