2022-03-26 23:58:22 +00:00
|
|
|
import { withValidation } from "next-validations";
|
2022-04-01 20:04:42 +00:00
|
|
|
import { z } from "zod";
|
2022-03-26 23:58:22 +00:00
|
|
|
|
2022-03-30 15:37:51 +00:00
|
|
|
import { _AttendeeModel as Attendee } from "@calcom/prisma/zod";
|
|
|
|
|
2022-04-01 20:04:42 +00:00
|
|
|
export const schemaAttendeeBaseBodyParams = Attendee.omit({ id: true }).partial();
|
2022-03-30 15:37:51 +00:00
|
|
|
|
|
|
|
export const schemaAttendeePublic = Attendee.omit({});
|
|
|
|
|
2022-04-01 20:04:42 +00:00
|
|
|
const schemaAttendeeRequiredParams = z.object({
|
|
|
|
email: z.string().email(),
|
|
|
|
name: z.string(),
|
|
|
|
timeZone: z.string(),
|
|
|
|
});
|
|
|
|
|
|
|
|
export const schemaAttendeeBodyParams = schemaAttendeeBaseBodyParams.merge(schemaAttendeeRequiredParams);
|
|
|
|
|
2022-03-30 15:37:51 +00:00
|
|
|
export const withValidAttendee = withValidation({
|
|
|
|
schema: schemaAttendeeBodyParams,
|
2022-03-26 23:58:22 +00:00
|
|
|
type: "Zod",
|
|
|
|
mode: "body",
|
|
|
|
});
|