26 lines
710 B
TypeScript
26 lines
710 B
TypeScript
import {
|
|
authenticateRelayNode,
|
|
authorizationRevisionDelta,
|
|
} 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;
|
|
after_revision?: number;
|
|
}>(request);
|
|
return Response.json(
|
|
await authorizationRevisionDelta({
|
|
principal,
|
|
tenantId: payload.tenant_id ?? "",
|
|
afterRevision: Number(payload.after_revision ?? -1),
|
|
}),
|
|
{ headers: { "cache-control": "no-store" } },
|
|
);
|
|
} catch (error) {
|
|
return apiError(error);
|
|
}
|
|
}
|