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
+6 -3
View File
@@ -50,18 +50,21 @@ export async function getTaskById(id: number) {
}
export async function createTask(data: {
contractId: number;
contractId?: number | null;
title: string;
description?: string;
visibleInPortal?: boolean;
createdBy?: string;
}) {
// Ohne Vertrag (allgemeine Aufgabe) gibt es keinen Kunden → nie im Portal
// sichtbar, egal was der Client schickt.
const hasContract = data.contractId != null;
return prisma.contractTask.create({
data: {
contractId: data.contractId,
contractId: data.contractId ?? null,
title: data.title,
description: data.description,
visibleInPortal: data.visibleInPortal ?? false,
visibleInPortal: hasContract ? (data.visibleInPortal ?? false) : false,
createdBy: data.createdBy,
},
});