Integration: Stubs von L2/L3/L4/L5 gegen echte Services getauscht
- Aufträge: createWorkOrder/transitionWorkOrder/getCompletionBlockers aus L2 - Dokumente: storeFile aus L1; neu services/documents/read.ts (readStoredBytes, readDocumentBytes mit Prüfsummenprüfung); L2-Upload nutzt zentrale Ablage - Dubletten aus L1 (findDuplicateCustomers(ctx)); Objekt-Kandidaten als imports/site-candidates.ts; Dateityp-Erkennung mobil als field/mime.ts - Objekt-Historie mobil als Adapter auf L1 getSiteHistory, PDF über /api/v1/reports/:id/pdf - L4-Upload-Idempotenz: fester Upload-Lineage nach storeFile, Race → Soft-Delete + Replay - PDF-Worker-Kontext: document:write zum Ablegen des Berichts-PDF - Import: doppeltes Work-Order-Audit entfernt; bestätigte Aufträge starten planned - Dateilinks in Auftragsdetail auf /files/[documentId] - proxy: /api/v1 ohne Session → 401 JSON statt Login-Redirect - ARCHITEKTUR §2: Objekt-Historie für Feldrollen (freigegebene Einsätze aller Teams) Gate: tsc, lint, build, 42/42 Tests grün. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -43,6 +43,13 @@ export function proxy(request: NextRequest) {
|
||||
request.cookies.has("__Secure-authjs.session-token");
|
||||
|
||||
if (!hasSessionCookie) {
|
||||
// Versioned API: machine clients (PWA sync, integrations) need a status code, not a login page.
|
||||
if (pathname === "/api/v1" || pathname.startsWith("/api/v1/")) {
|
||||
return NextResponse.json(
|
||||
{ error: { code: "unauthorized", message: "Nicht angemeldet." } },
|
||||
{ status: 401, headers: { "Cache-Control": "no-store" } },
|
||||
);
|
||||
}
|
||||
const loginUrl = new URL("/login", request.url);
|
||||
if (pathname !== "/") loginUrl.searchParams.set("callbackUrl", pathname);
|
||||
return NextResponse.redirect(loginUrl);
|
||||
|
||||
Reference in New Issue
Block a user