25 lines
702 B
TypeScript
25 lines
702 B
TypeScript
import {
|
|
authenticateRelayNode,
|
|
revokePhoneForRelay,
|
|
} 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;
|
|
phone_id?: string;
|
|
reason?: string;
|
|
}>(request);
|
|
return Response.json(await revokePhoneForRelay({
|
|
principal,
|
|
tenantId: payload.tenant_id ?? "",
|
|
phoneId: payload.phone_id ?? "",
|
|
reason: payload.reason ?? "",
|
|
}), { headers: { "cache-control": "no-store" } });
|
|
} catch (error) {
|
|
return apiError(error);
|
|
}
|
|
}
|