feat: add capture time overrides and apply in queries

This commit is contained in:
William Valentin
2026-02-02 21:21:11 -08:00
parent 1f8c28e1db
commit 6525a553ae
6 changed files with 216 additions and 41 deletions

View File

@@ -0,0 +1,31 @@
import { z } from "zod";
import { getAdminOk, handleSetCaptureOverride } from "./handlers";
export const runtime = "nodejs";
const paramsSchema = z.object({
id: z.string().uuid(),
});
export async function POST(
request: Request,
context: { params: Promise<{ id: string }> },
): Promise<Response> {
const rawParams = await context.params;
const paramsParsed = paramsSchema.safeParse(rawParams);
if (!paramsParsed.success) {
return Response.json(
{ error: "invalid_params", issues: paramsParsed.error.issues },
{ status: 400 },
);
}
const bodyJson = await request.json().catch(() => ({}));
const res = await handleSetCaptureOverride({
adminOk: getAdminOk(request.headers),
params: paramsParsed.data,
body: bodyJson,
});
return Response.json(res.body, { status: res.status });
}