ADD: changed to rect router

This commit is contained in:
hwinkel
2026-03-10 21:49:01 +01:00
parent 44e79e657f
commit 4bc57b2c4e
102 changed files with 5067 additions and 4824 deletions
+14
View File
@@ -0,0 +1,14 @@
import prisma from "./prisma";
export async function generateInvoiceNumber(companyId: string): Promise<string> {
const year = new Date().getFullYear();
const company = await prisma.company.update({
where: { id: companyId },
data: { invoiceSequence: { increment: 1 } },
select: { invoicePrefix: true, invoiceSequence: true },
});
const seq = String(company.invoiceSequence).padStart(3, "0");
return `${company.invoicePrefix}-${year}-${seq}`;
}