2022-03-30 12:17:55 +00:00
|
|
|
import type { NextApiRequest, NextApiResponse } from "next";
|
2022-03-28 22:27:14 +00:00
|
|
|
|
2022-03-30 12:17:55 +00:00
|
|
|
import prisma from "@calcom/prisma";
|
2022-03-28 22:27:14 +00:00
|
|
|
import { DestinationCalendar } from "@calcom/prisma/client";
|
|
|
|
|
|
|
|
type ResponseData = {
|
|
|
|
data?: DestinationCalendar[];
|
|
|
|
error?: unknown;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default async function destinationCalendar(req: NextApiRequest, res: NextApiResponse<ResponseData>) {
|
|
|
|
const data = await prisma.destinationCalendar.findMany();
|
|
|
|
if (data) res.status(200).json({ data });
|
|
|
|
else res.status(400).json({ error: "No data found" });
|
|
|
|
}
|