feat: Recurring invoices + license suspend on dunning level 3 (PRD §6.4/§6.6)

- Recurring API: list contracts needing invoicing + run endpoint
- Auto-generate draft invoices for Wartung/SLA + Dienstvertrag contracts
- Automatic license suspension at dunning level 3 (PRD §6.4)
- Recurring billable expenses tracking
- MRR/ARR computation from contracts + expenses
- Prisma: added Contract.company + Expense.company relations
- Scheduler info (pg-boss monthly cron in production)
This commit is contained in:
Z User committed 2026-10-27 16:51:58 +00:00
1 parent c8b4be55f3
commit 597bfbc3d8
8 files changed
+453

No files matched your search

+4
View File
@@ -81,6 +81,8 @@ model Company {
licenses License[]
invoices Invoice[]
projects Project[]
contracts Contract[]
expenses Expense[]
}
model Person {
@@ -300,6 +302,7 @@ model Contract {
id String @id @default(cuid())
number String @unique // gapless, e.g. VER-2026-0001
companyId String
company Company @relation(fields: [companyId], references: [id])
type String // werkvertrag|dienstvertrag|wartung-sla|avv|nda|dpa
title String
status String @default("draft") // draft|sent|signed|active|expired|terminated
@@ -335,6 +338,7 @@ model Expense {
date DateTime @default(now())
// linking
companyId String? // customer this is billable to
company Company? @relation(fields: [companyId], references: [id])
projectId String? // project this relates to
billable Boolean @default(false) // convert to customer invoice
markupPct Int @default(0) // markup when re-billed