23 lines
699 B
TypeScript
23 lines
699 B
TypeScript
import {
|
|
authenticateRelayNode,
|
|
fullAuthorizationSnapshot,
|
|
} from "@/db/relay-control-plane";
|
|
import { apiError, readJsonMutation } from "../../../respond";
|
|
|
|
export async function POST(request: Request) {
|
|
try {
|
|
const principal = await authenticateRelayNode(request);
|
|
const payload = await readJsonMutation<{
|
|
tenant_id?: string;
|
|
placement_generation?: number;
|
|
}>(request);
|
|
return Response.json(await fullAuthorizationSnapshot({
|
|
principal,
|
|
tenantId: payload.tenant_id ?? "",
|
|
placementGeneration: Number(payload.placement_generation ?? -1),
|
|
}), { headers: { "cache-control": "no-store" } });
|
|
} catch (error) {
|
|
return apiError(error);
|
|
}
|
|
}
|