fix: request data notification when new

This commit is contained in:
Methapon2001 2025-04-30 15:00:43 +07:00
parent 8a4317c94e
commit 07e5f53be2

View file

@ -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;