L1 Stammdaten: Services, Dublettenprüfung, Server Actions und API v1

Kunden (Nummernkreis, Ansprechpartner, vorläufig bestätigen, Zusammenführen mit
Bestätigung), Objekte inkl. Historie, Teams mit Mitgliedschaften, Dublettenlogik
(lib + Service), API-Kontext/Antwortformat unter src/server/api und die Endpunkte
/api/v1/customers, /api/v1/sites, /api/v1/sites/[id]/history.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-14 12:26:07 +02:00
co-authored by Claude Opus 5
parent bf4456718e
commit 1f8e6413fe
23 changed files with 1836 additions and 61 deletions
@@ -0,0 +1,21 @@
import { requireApiContext } from "@/server/api/context";
import { json, parsePagination, withApi } from "@/server/api/respond";
import { getSiteHistory } from "@/server/services/sites/history";
/**
* GET /api/v1/sites/:id/history?onlyApproved=true&page&pageSize
* Field roles always receive released deployments only (see getSiteHistory).
*/
export const GET = withApi(async (req: Request, { params }: { params: Promise<{ id: string }> }) => {
const ctx = await requireApiContext("sites", "site:read");
const { id } = await params;
const url = new URL(req.url);
const { page, pageSize } = parsePagination(url, { pageSize: 50 });
const flag = url.searchParams.get("onlyApproved");
const result = await getSiteHistory(ctx, id, { onlyApproved: flag === "true" || flag === "1", page, pageSize });
return json({
data: result.items,
pagination: { page: result.page, pageSize: result.pageSize, total: result.total },
meta: { onlyApproved: result.onlyApproved },
});
});