From e655bf282c6812aa50624802d098fff0fe082d9a Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Thu, 14 Nov 2024 13:10:08 +0700 Subject: [PATCH] feat: prevent from change after completed --- src/controllers/05-payment-controller.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/controllers/05-payment-controller.ts b/src/controllers/05-payment-controller.ts index c000278..68dfb60 100644 --- a/src/controllers/05-payment-controller.ts +++ b/src/controllers/05-payment-controller.ts @@ -127,6 +127,8 @@ export class QuotationPayment extends Controller { if (!record) throw notFoundError("Payment"); + if (record.paymentStatus === "PaymentSuccess") return record; + return await prisma.$transaction(async (tx) => { const current = new Date(); const year = `${current.getFullYear()}`.slice(-2).padStart(2, "0");