import { NextResponse } from "next/server"; import { api } from "@/server/api"; import { rechtErforderlich } from "@/server/auth/zugang"; import { auftragHolen, logAb } from "@/server/services/auftraege"; type Kontext = { params: Promise<{ id: string }> }; /** Detail-Log ab einer Zeilen-ID (`?ab=`), für Polling und `proxdeploy logs`. */ export const GET = api(async (anfrage: Request, { params }: Kontext) => { await rechtErforderlich(anfrage, "lesen"); const auftrag = await auftragHolen((await params).id); const ab = new URL(anfrage.url).searchParams.get("ab"); return NextResponse.json(await logAb(auftrag.id, BigInt(/^\d+$/.test(ab ?? "") ? ab! : "0"))); });