From 6e811d1b0303049d136b3c96d24237ec9c3b3742 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Tue, 26 Sep 2023 10:58:42 +0200 Subject: [PATCH] :bug: Fixing notifications --- package-lock.json | 12 ++++++------ src/app/api/common/UserNotificationController.ts | 7 +++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1df15f3a..61364bbb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1598,9 +1598,9 @@ } }, "node_modules/@types/node": { - "version": "18.17.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.17.19.tgz", - "integrity": "sha512-+pMhShR3Or5GR0/sp4Da7FnhVmTalWm81M6MkEldbwjETSaPalw138Z4KdpQaistvqQxLB7Cy4xwYdxpbSOs9Q==" + "version": "18.18.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.0.tgz", + "integrity": "sha512-3xA4X31gHT1F1l38ATDIL9GpRLdwVhnEFC8Uikv5ZLlXATwrCYyPq7ZWHxzxc3J/30SUiwiYT+bQe0/XvKlWbw==" }, "node_modules/@types/node-fetch": { "version": "2.6.6", @@ -2766,9 +2766,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/electron-to-chromium": { - "version": "1.4.528", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.528.tgz", - "integrity": "sha512-UdREXMXzLkREF4jA8t89FQjA8WHI6ssP38PMY4/4KhXFQbtImnghh4GkCgrtiZwLKUKVD2iTVXvDVQjfomEQuA==", + "version": "1.4.529", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.529.tgz", + "integrity": "sha512-6uyPyXTo8lkv8SWAmjKFbG42U073TXlzD4R8rW3EzuznhFS2olCIAfjjQtV2dV2ar/vRF55KUd3zQYnCB0dd3A==", "dev": true }, "node_modules/emittery": { diff --git a/src/app/api/common/UserNotificationController.ts b/src/app/api/common/UserNotificationController.ts index 39709b82..3450460e 100644 --- a/src/app/api/common/UserNotificationController.ts +++ b/src/app/api/common/UserNotificationController.ts @@ -4,6 +4,7 @@ import ApiController from "@Common/system/controller-pattern/ApiController"; import { Service } from "typedi"; import UserNotification from "le-coffre-resources/dist/Notary/UserNotification"; import UserNotificationService from "@Services/common/UserNotificationService/UserNotificationService"; +import authHandler from "@App/middlewares/AuthHandler"; @Controller() @Service() @@ -15,15 +16,17 @@ export default class UserNotificationController extends ApiController { /** * @description Get all customers */ - @Get("/api/v1/notifications") + @Get("/api/v1/notifications", [authHandler]) protected async get(req: Request, response: Response) { try { //get query - let query; + let query: any = {}; if (req.query["q"]) { query = JSON.parse(req.query["q"] as string); } + query.where = { user: { uid: req.body.user.uid } }; + //call service to get prisma entity const userNotificationEntities = await this.userNotificationService.get(query);