diff --git a/backend/src/controllers/contract.controller.ts b/backend/src/controllers/contract.controller.ts index e6ec14e5..e7e4eb0b 100644 --- a/backend/src/controllers/contract.controller.ts +++ b/backend/src/controllers/contract.controller.ts @@ -230,6 +230,28 @@ export async function updateContract(req: AuthRequest, res: Response): Promise)) { + let validated: string | null; + try { + validated = validateOptionalIsoDate((sanitizedBody as Record)[df], df); + } catch (err) { + res.status(400).json({ + success: false, + error: err instanceof Error ? err.message : 'Ungültiges Datum', + } as ApiResponse); + return; + } + (sanitizedBody as Record)[df] = validated ? new Date(validated) : null; + } + } + const contract = await contractService.updateContract(contractId, sanitizedBody as any); // Wenn über das Formular ein (neues/geändertes) Kündigungsbestätigungs- diff --git a/docs/todo.md b/docs/todo.md index bfbc100c..8c4ec332 100644 --- a/docs/todo.md +++ b/docs/todo.md @@ -112,6 +112,17 @@ isolierte Instanz (keine Multi-Tenancy im Code), Provisioning + Abrechnung ACTIVE/DRAFT/CANCELLED. Eigene Liste `cancellationConfirmations` im Cockpit-Result (weil bereits CANCELLED-Verträge mangels „Issue" sonst nicht auftauchen) + neue Filter-Option im Cockpit-Dropdown. Verifiziert. + - **Nachbesserungen Pentest R138:** + - `endDate` wird bei **DRAFT** nicht mehr gesetzt (Entwurf = Vorlage); + nur ACTIVE/CANCELLED bekommen Vertragsende = Kündigungsdatum. + - `cancellationConfirmationDate`/`-OptionsDate` im Update-Pfad über + `validateOptionalIsoDate` normalisiert → akzeptiert Datum-only UND + volles ISO (vorher lehnte Prisma Datum-only ab), konsistent zum Upload. + - **Gutschrift-Dateien:** Überweisungsbelege (`credit-note-receipts`) sind + jetzt **staff-only** (neuer FileOwner-Typ `contract-staff`, Portal 403); + das Gutschrift-**PDF** (`credit-notes`) bleibt vertragsbasiert (eigener + Kunde darf seine Gutschrift laden). Anlegen/Beleg-Upload für Portal war + bereits per `blockPortal`/Portal-403 gesperrt. - [~] **🧾 Gutschriftsverwaltung (Subventionen am Vertrag) – Phase 1: Backend** (2026-08-06) - Use-Case: zu einem Vertrag kann eine Subvention gewährt werden – **Geld**