feat: initialize CalBook project with comprehensive scheduling, admin, and deployment infrastructure

This commit is contained in:
2026-05-07 13:04:02 +02:00
parent 51acfe9488
commit ee48a93824
133 changed files with 26049 additions and 0 deletions

21
lib/api.ts Normal file
View File

@@ -0,0 +1,21 @@
import { NextResponse } from "next/server";
export function ok(data: unknown, status = 200) {
return NextResponse.json(data, { status });
}
export function fail(message: string, status = 400, details?: unknown) {
return NextResponse.json({ message, details }, { status });
}
export function handleAuthError(error: unknown) {
if (error instanceof Error) {
if (error.message === "UNAUTHORIZED") {
return fail("Nicht angemeldet", 401);
}
if (error.message === "FORBIDDEN") {
return fail("Keine Berechtigung", 403);
}
}
return fail("Interner Fehler", 500);
}