From c6c37621c41c20ad9c1510a828697de3a320cec5 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Tue, 26 Sep 2023 12:08:19 +0200 Subject: [PATCH] :sparkles: Fixing notifications --- src/app/api/common/UserNotificationController.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/api/common/UserNotificationController.ts b/src/app/api/common/UserNotificationController.ts index 3450460e..eec01d06 100644 --- a/src/app/api/common/UserNotificationController.ts +++ b/src/app/api/common/UserNotificationController.ts @@ -25,8 +25,12 @@ export default class UserNotificationController extends ApiController { query = JSON.parse(req.query["q"] as string); } - query.where = { user: { uid: req.body.user.uid } }; - + if (query.where) { + query.where = { ...query.where, user: { uid: req.body.user.uid } }; + } else { + query.where = { user: { uid: req.body.user.uid } }; + } + query.include = { notification: true }; //call service to get prisma entity const userNotificationEntities = await this.userNotificationService.get(query);