Some fixes

This commit is contained in:
Vins 2023-09-22 11:41:32 +02:00
parent 51970e0435
commit d6d358f579
3 changed files with 5 additions and 6 deletions

1
package-lock.json generated
View File

@ -170,7 +170,6 @@
"@babel/helper-module-transforms": "^7.22.20", "@babel/helper-module-transforms": "^7.22.20",
"@babel/helpers": "^7.22.15", "@babel/helpers": "^7.22.15",
"@babel/parser": "^7.22.16", "@babel/parser": "^7.22.16",
"@babel/parser": "^7.22.16",
"@babel/template": "^7.22.15", "@babel/template": "^7.22.15",
"@babel/traverse": "^7.22.20", "@babel/traverse": "^7.22.20",
"@babel/types": "^7.22.19", "@babel/types": "^7.22.19",

View File

@ -10,12 +10,12 @@ import authHandler from "@App/middlewares/AuthHandler";
import ruleHandler from "@App/middlewares/RulesHandler"; import ruleHandler from "@App/middlewares/RulesHandler";
import documentHandler from "@App/middlewares/OfficeMembershipHandlers/DocumentHandler"; import documentHandler from "@App/middlewares/OfficeMembershipHandlers/DocumentHandler";
import EmailBuilder from "@Common/emails/EmailBuilder"; import EmailBuilder from "@Common/emails/EmailBuilder";
import NotificationBuilder from "@Common/notifications/NotificationBuilder"; // import NotificationBuilder from "@Common/notifications/NotificationBuilder";
@Controller() @Controller()
@Service() @Service()
export default class DocumentsController extends ApiController { export default class DocumentsController extends ApiController {
constructor(private documentsService: DocumentsService, private emailBuilder: EmailBuilder, private notificationBuilder: NotificationBuilder) { constructor(private documentsService: DocumentsService, private emailBuilder: EmailBuilder) {
super(); super();
} }
@ -113,8 +113,8 @@ export default class DocumentsController extends ApiController {
const documentEntityUpdated: Documents = await this.documentsService.update(uid, documentEntity, req.body.refused_reason); const documentEntityUpdated: Documents = await this.documentsService.update(uid, documentEntity, req.body.refused_reason);
//create email for asked document //create email for asked document
this.emailBuilder.sendDocumentEmails(documentEntityUpdated); // this.emailBuilder.sendDocumentEmails(documentEntityUpdated);
this.notificationBuilder.sendDocumentAnchoredNotificatiom(documentEntityUpdated); // this.notificationBuilder.sendDocumentAnchoredNotificatiom(documentEntityUpdated);
//Hydrate ressource with prisma entity //Hydrate ressource with prisma entity
const document = Document.hydrate<Document>(documentEntityUpdated, { strategy: "excludeAll" }); const document = Document.hydrate<Document>(documentEntityUpdated, { strategy: "excludeAll" });

View File

@ -27,7 +27,7 @@ export default class NotificationBuilder {
} }
public async sendDocumentAnchoredNotificatiom(documentEntity: Documents){ 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}} }); 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"); if(!documentPrisma) throw new Error("Document not found");