From 2905983bfde05fe4d6aeb874b581853f765e2d83 Mon Sep 17 00:00:00 2001 From: Astrian Zheng Date: Sun, 12 Jan 2025 09:31:39 +1100 Subject: [PATCH] feat: update invoice suffix code generation logic to ensure unique suffix for new invoices --- backend/src/classes/Invoice.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/classes/Invoice.ts b/backend/src/classes/Invoice.ts index 21f2a8c..a6dc9d0 100644 --- a/backend/src/classes/Invoice.ts +++ b/backend/src/classes/Invoice.ts @@ -111,6 +111,9 @@ class Invoice { } }) + // 更新收据后缀 + this.suffixCode = maxSuffix ? maxSuffix.invoice_suffix_code + 1 : 1 + // 在数据库中创建新收据 const newInvoice = await prisma.invoice.create({ data: {