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>
18 lines
618 B
TypeScript
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" };
|