cal.pub0.org/pages/api/me/_get.ts

13 lines
403 B
TypeScript
Raw Normal View History

import type { NextApiRequest } from "next";
import { defaultResponder } from "@calcom/lib/server";
2022-11-25 13:56:58 +00:00
import { schemaUserReadPublic } from "~/lib/validations/user";
2022-10-11 00:02:36 +00:00
async function handler({ userId, prisma }: NextApiRequest) {
2022-09-06 17:40:23 +00:00
const data = await prisma.user.findUniqueOrThrow({ where: { id: userId } });
2022-10-11 00:02:36 +00:00
return { user: schemaUserReadPublic.parse(data) };
}
export default defaultResponder(handler);