15 lines
474 B
TypeScript
15 lines
474 B
TypeScript
import type { NextApiRequest } from "next";
|
|
|
|
import { defaultResponder } from "@calcom/lib/server";
|
|
|
|
import { schemaQueryIdAsString } from "@lib/validations/shared/queryIdString";
|
|
|
|
async function deleteHandler(req: NextApiRequest) {
|
|
const { prisma, query } = req;
|
|
const { id } = schemaQueryIdAsString.parse(query);
|
|
await prisma.apiKey.delete({ where: { id } });
|
|
return { message: `ApiKey with id: ${id} deleted` };
|
|
}
|
|
|
|
export default defaultResponder(deleteHandler);
|