Architektur: Craftvia-Domänenmodell, Verträge und Team-Schnitte

- Migration 0002_craftvia_domain: 27 Fachtabellen inkl. RLS (enable_tenant_rls)
- TENANT_MODELS (db.ts, backup/topology.ts) um alle Fachmodelle ergänzt
- moduleGuard liefert DB-autoritative Rechte; ServiceCtx für Domänen-Services
- Verträge: Statusmaschine, Events, Nummernkreise, Sichtbarkeits-Scopes,
  Job-Queues + Worker, KI-Provider-Interfaces, Sync-Envelope
- docs/craftvia/ARCHITEKTUR.md mit Lanes, Ownership und DoD

Gate: tsc, lint, build, 22/22 Tests grün.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-14 11:49:21 +02:00
co-authored by Claude Opus 5
parent 1701db0a62
commit bf4456718e
21 changed files with 2670 additions and 12 deletions
+23
View File
@@ -0,0 +1,23 @@
import type { JobPayload, JobQueueName } from "../queues";
export type JobProcessor = (payload: JobPayload) => Promise<void>;
/**
* Processor registry. Each lane adds exactly ONE line for its queue, e.g.
* [JOB_QUEUES.importExtraction]: () => import("./import-extraction").then((m) => m.process),
* Lazy imports keep the app bundle free of worker-only dependencies (Playwright etc.).
*/
export const PROCESSORS: Partial<Record<JobQueueName, () => Promise<JobProcessor>>> = {
// lane-imports: "import-extraction": () => import("./import-extraction").then((m) => m.process),
// lane-lotse: "transcription": () => import("./transcription").then((m) => m.process),
// lane-reports: "report-pdf": () => import("./report-pdf").then((m) => m.process),
// lane-field: "image-derivatives": () => import("./image-derivatives").then((m) => m.process),
};
/** Inline fallback when no Redis is available (dev/demo). */
export async function runInline(name: JobQueueName, payload: JobPayload): Promise<void> {
const load = PROCESSORS[name];
if (!load) throw new Error(`no processor registered for ${name}`);
const process = await load();
await process(payload);
}