19 lines
534 B
TypeScript
19 lines
534 B
TypeScript
import prisma from "@calcom/prisma";
|
|
|
|
import { ApiKey } from "@prisma/client";
|
|
import type { NextApiRequest, NextApiResponse } from "next";
|
|
|
|
type ResponseData = {
|
|
data?: ApiKey[];
|
|
error?: unknown;
|
|
message?: string;
|
|
};
|
|
|
|
export default async function apiKeys(req: NextApiRequest, res: NextApiResponse<ResponseData>) {
|
|
const { method } = req;
|
|
if (method === "GET") {
|
|
const data = await prisma.apiKey.findMany({});
|
|
res.status(200).json({ data });
|
|
} else res.status(405).json({ message: "Only GET Method allowed" });
|
|
}
|