Aufgaben ohne Kunde/Vertrag anlegbar

ContractTask.contractId nullable (Migration). Neuer staff-only Endpoint
POST /tasks fuer allgemeine Aufgaben ohne Vertrag/Kunde. Ohne Vertrag gibt
es keinen Kunden -> visibleInPortal serverseitig immer false, Portal-Reply
403 bei contractloser Aufgabe, getAllTasks-Portal-Filter schliesst sie
automatisch aus (kein contract-Match).

Task-Modal (Mitarbeiter): Checkbox "Ohne Kunde (allgemeine Aufgabe)" blendet
Kunden-/Vertragsauswahl UND "Im Kundenportal sichtbar" aus. Task-Liste zeigt
solche Aufgaben als "Allgemeine Aufgabe (ohne Vertrag)" ohne Vertrags-Link/
Zum-Vertrag-Button.

Verifiziert: contractlose Aufgabe -> contractId null, visibleInPortal
erzwungen false (auch wenn true geschickt); mit Vertrag weiterhin waehlbar.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-18 14:15:33 +02:00
co-authored by Claude Opus 4.8
parent b8128616f2
commit 15142676ef
9 changed files with 161 additions and 35 deletions
@@ -0,0 +1,4 @@
-- Aufgaben ohne Vertrag/Kunde erlauben: contractId nullable.
-- Der bestehende FK (onDelete Cascade) bleibt: gesetzte contractId cascaden
-- weiterhin, NULL bleibt unberührt.
ALTER TABLE `ContractTask` MODIFY COLUMN `contractId` INT NULL;
+4 -2
View File
@@ -870,8 +870,10 @@ enum ContractTaskStatus {
model ContractTask {
id Int @id @default(autoincrement())
contractId Int
contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)
// Nullable: Aufgaben können auch OHNE Vertrag/Kunde angelegt werden
// (allgemeine interne Aufgabe). Ohne Vertrag → kein Kunde → nie im Portal.
contractId Int?
contract Contract? @relation(fields: [contractId], references: [id], onDelete: Cascade)
title String
description String? @db.Text
status ContractTaskStatus @default(OPEN)