fix: wrong update
This commit is contained in:
parent
a811c17bde
commit
5fa6e4d2f9
1 changed files with 4 additions and 2 deletions
|
|
@ -150,7 +150,10 @@ export class QuotationPayment extends Controller {
|
|||
|
||||
const payment = await tx.payment.update({
|
||||
where: { id: paymentId, invoice: { quotationId: quotation.id } },
|
||||
data: body,
|
||||
data: {
|
||||
...body,
|
||||
code: last ? `RE${year}${month}${last.value.toString().padStart(6, "0")}` : undefined,
|
||||
},
|
||||
});
|
||||
|
||||
const paymentSum = await prisma.payment.aggregate({
|
||||
|
|
@ -170,7 +173,6 @@ export class QuotationPayment extends Controller {
|
|||
await tx.quotation.update({
|
||||
where: { id: quotation.id },
|
||||
data: {
|
||||
code: last ? `RE${year}${month}${last.value.toString().padStart(6, "0")}` : undefined,
|
||||
quotationStatus:
|
||||
paymentSum._sum.amount || 0 >= quotation.finalPrice
|
||||
? "PaymentSuccess"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue