From 07e5f53be2eee4dbac07bda8387d4cceaa67a90a Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 30 Apr 2025 15:00:43 +0700 Subject: [PATCH] fix: request data notification when new --- src/controllers/05-payment-controller.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/controllers/05-payment-controller.ts b/src/controllers/05-payment-controller.ts index e5bf0a4..711e357 100644 --- a/src/controllers/05-payment-controller.ts +++ b/src/controllers/05-payment-controller.ts @@ -181,6 +181,7 @@ export class QuotationPayment extends Controller { await tx.quotation .update({ + include: { requestData: true }, where: { id: quotation.id }, data: { quotationStatus: @@ -238,6 +239,17 @@ export class QuotationPayment extends Controller { receiverId: res.createdByUserId, }, }); + + if (quotation.quotationStatus === "PaymentPending") { + await prisma.notification.create({ + data: { + title: "รายการคำขอใหม่ / New Request", + detail: "รหัส / code : " + res.requestData.map((v) => v.code).join(", "), + registeredBranchId: res.registeredBranchId, + groupReceiver: { create: { name: "document_checker" } }, + }, + }); + } }); return payment;