2022-03-26 23:58:22 +00:00
|
|
|
import prisma from "@calcom/prisma";
|
|
|
|
|
|
|
|
import { Attendee } from "@calcom/prisma/client";
|
|
|
|
import type { NextApiRequest, NextApiResponse } from "next";
|
|
|
|
|
|
|
|
type ResponseData = {
|
|
|
|
data?: Attendee[];
|
|
|
|
error?: unknown;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default async function attendee(req: NextApiRequest, res: NextApiResponse<ResponseData>) {
|
|
|
|
try {
|
2022-03-28 14:05:00 +00:00
|
|
|
const data = await prisma.attendee.findMany();
|
|
|
|
res.status(200).json({ data });
|
2022-03-26 23:58:22 +00:00
|
|
|
} catch (error) {
|
|
|
|
// FIXME: Add zod for validation/error handling
|
|
|
|
res.status(400).json({ error: error });
|
|
|
|
}
|
|
|
|
}
|