🐛 Fixing notifications

This commit is contained in:
Maxime Lalo 2023-09-26 10:58:42 +02:00
parent 8bd6b30b83
commit 6e811d1b03
2 changed files with 11 additions and 8 deletions

12
package-lock.json generated
View File

@ -1598,9 +1598,9 @@
} }
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "18.17.19", "version": "18.18.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.17.19.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.0.tgz",
"integrity": "sha512-+pMhShR3Or5GR0/sp4Da7FnhVmTalWm81M6MkEldbwjETSaPalw138Z4KdpQaistvqQxLB7Cy4xwYdxpbSOs9Q==" "integrity": "sha512-3xA4X31gHT1F1l38ATDIL9GpRLdwVhnEFC8Uikv5ZLlXATwrCYyPq7ZWHxzxc3J/30SUiwiYT+bQe0/XvKlWbw=="
}, },
"node_modules/@types/node-fetch": { "node_modules/@types/node-fetch": {
"version": "2.6.6", "version": "2.6.6",
@ -2766,9 +2766,9 @@
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.4.528", "version": "1.4.529",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.528.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.529.tgz",
"integrity": "sha512-UdREXMXzLkREF4jA8t89FQjA8WHI6ssP38PMY4/4KhXFQbtImnghh4GkCgrtiZwLKUKVD2iTVXvDVQjfomEQuA==", "integrity": "sha512-6uyPyXTo8lkv8SWAmjKFbG42U073TXlzD4R8rW3EzuznhFS2olCIAfjjQtV2dV2ar/vRF55KUd3zQYnCB0dd3A==",
"dev": true "dev": true
}, },
"node_modules/emittery": { "node_modules/emittery": {

View File

@ -4,6 +4,7 @@ import ApiController from "@Common/system/controller-pattern/ApiController";
import { Service } from "typedi"; import { Service } from "typedi";
import UserNotification from "le-coffre-resources/dist/Notary/UserNotification"; import UserNotification from "le-coffre-resources/dist/Notary/UserNotification";
import UserNotificationService from "@Services/common/UserNotificationService/UserNotificationService"; import UserNotificationService from "@Services/common/UserNotificationService/UserNotificationService";
import authHandler from "@App/middlewares/AuthHandler";
@Controller() @Controller()
@Service() @Service()
@ -15,15 +16,17 @@ export default class UserNotificationController extends ApiController {
/** /**
* @description Get all customers * @description Get all customers
*/ */
@Get("/api/v1/notifications") @Get("/api/v1/notifications", [authHandler])
protected async get(req: Request, response: Response) { protected async get(req: Request, response: Response) {
try { try {
//get query //get query
let query; let query: any = {};
if (req.query["q"]) { if (req.query["q"]) {
query = JSON.parse(req.query["q"] as string); query = JSON.parse(req.query["q"] as string);
} }
query.where = { user: { uid: req.body.user.uid } };
//call service to get prisma entity //call service to get prisma entity
const userNotificationEntities = await this.userNotificationService.get(query); const userNotificationEntities = await this.userNotificationService.get(query);