Files
craftvia/src/lib/work-orders/action-state.ts
T
msolarczekandClaude Opus 5 2311b35d8c L2 Aufträge & Backoffice: Service-Schicht Aufträge + Tests
Statusmaschine (transitionWorkOrder inkl. eventData), Zuweisung, Completion-Guards,
Materialvorgabe, Checklisten/Pflichtfotos, Liste/Dashboard-Presets, Suche,
Sync-Konflikte, Einstellungen (Auftragsarten, Vorlagen, Nummernkreise).
Tests: Übergangsmatrix je Rolle, Kernlogik, Scope/Mandantentrennung, Nummernkreis-Parallelität.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 12:29:15 +02:00

18 lines
618 B
TypeScript

import type { CompletionBlocker } from "@/lib/work-orders/status";
/** Result of a work order server action (client-safe; rendered by components/work-orders/action-form.tsx). */
export type ActionState =
| { status: "idle" }
| { status: "ok"; at: number }
| {
status: "error";
/** ServiceError code: not_found | forbidden | invalid | conflict | blocked | internal */
code: string;
/** message key below `errors.` (falls back to the code) */
message: string;
blockers?: CompletionBlocker[];
at: number;
};
export const IDLE_STATE: ActionState = { status: "idle" };