From d6d358f579cb5ce9b3f94455e5a424c381f68136 Mon Sep 17 00:00:00 2001 From: Vins Date: Fri, 22 Sep 2023 11:41:32 +0200 Subject: [PATCH] Some fixes --- package-lock.json | 1 - src/app/api/notary/DocumentsController.ts | 8 ++++---- src/common/notifications/NotificationBuilder.ts | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6305d421..561d30fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -170,7 +170,6 @@ "@babel/helper-module-transforms": "^7.22.20", "@babel/helpers": "^7.22.15", "@babel/parser": "^7.22.16", - "@babel/parser": "^7.22.16", "@babel/template": "^7.22.15", "@babel/traverse": "^7.22.20", "@babel/types": "^7.22.19", diff --git a/src/app/api/notary/DocumentsController.ts b/src/app/api/notary/DocumentsController.ts index 8f0ce0ee..0be80d12 100644 --- a/src/app/api/notary/DocumentsController.ts +++ b/src/app/api/notary/DocumentsController.ts @@ -10,12 +10,12 @@ import authHandler from "@App/middlewares/AuthHandler"; import ruleHandler from "@App/middlewares/RulesHandler"; import documentHandler from "@App/middlewares/OfficeMembershipHandlers/DocumentHandler"; import EmailBuilder from "@Common/emails/EmailBuilder"; -import NotificationBuilder from "@Common/notifications/NotificationBuilder"; +// import NotificationBuilder from "@Common/notifications/NotificationBuilder"; @Controller() @Service() export default class DocumentsController extends ApiController { - constructor(private documentsService: DocumentsService, private emailBuilder: EmailBuilder, private notificationBuilder: NotificationBuilder) { + constructor(private documentsService: DocumentsService, private emailBuilder: EmailBuilder) { super(); } @@ -113,8 +113,8 @@ export default class DocumentsController extends ApiController { const documentEntityUpdated: Documents = await this.documentsService.update(uid, documentEntity, req.body.refused_reason); //create email for asked document - this.emailBuilder.sendDocumentEmails(documentEntityUpdated); - this.notificationBuilder.sendDocumentAnchoredNotificatiom(documentEntityUpdated); + // this.emailBuilder.sendDocumentEmails(documentEntityUpdated); + // this.notificationBuilder.sendDocumentAnchoredNotificatiom(documentEntityUpdated); //Hydrate ressource with prisma entity const document = Document.hydrate(documentEntityUpdated, { strategy: "excludeAll" }); diff --git a/src/common/notifications/NotificationBuilder.ts b/src/common/notifications/NotificationBuilder.ts index b7317b4a..6820ec19 100644 --- a/src/common/notifications/NotificationBuilder.ts +++ b/src/common/notifications/NotificationBuilder.ts @@ -27,7 +27,7 @@ export default class NotificationBuilder { } public async sendDocumentAnchoredNotificatiom(documentEntity: Documents){ - if(documentEntity.document_status !== "ANCHORED") return; + const documentPrisma = await this.documentsService.getByUid(documentEntity.uid, { depositor: {include: {contact: true}}, folder:{include:{ office: true, stakeholders: true}} }); if(!documentPrisma) throw new Error("Document not found");