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-27 17:25:36 +00:00
|
|
|
import { timeZone } from "@lib/validations/shared/timeZone";
|
|
|
|
|
2022-04-26 20:12:28 +00:00
|
|
|
export const schemaAttendeeBaseBodyParams = Attendee.pick({
|
|
|
|
bookingId: true,
|
|
|
|
email: true,
|
|
|
|
name: true,
|
|
|
|
timeZone: true,
|
|
|
|
}).partial();
|
2022-03-30 15:37:51 +00:00
|
|
|
|
2022-04-27 17:25:36 +00:00
|
|
|
const schemaAttendeeCreateParams = z
|
|
|
|
.object({
|
|
|
|
bookingId: z.number().int(),
|
|
|
|
email: z.string().email(),
|
2022-04-27 17:45:59 +00:00
|
|
|
name: z.string().optional(),
|
2022-04-27 17:25:36 +00:00
|
|
|
timeZone: timeZone,
|
|
|
|
})
|
|
|
|
.strict();
|
2022-04-01 20:04:42 +00:00
|
|
|
|
2022-04-27 17:25:36 +00:00
|
|
|
const schemaAttendeeEditParams = z
|
|
|
|
.object({
|
|
|
|
name: z.string().optional(),
|
|
|
|
email: z.string().email().optional(),
|
|
|
|
timeZone: timeZone.optional(),
|
|
|
|
})
|
|
|
|
.strict();
|
2022-04-26 20:48:15 +00:00
|
|
|
export const schemaAttendeeEditBodyParams = schemaAttendeeBaseBodyParams.merge(schemaAttendeeEditParams);
|
|
|
|
export const schemaAttendeeCreateBodyParams = schemaAttendeeBaseBodyParams.merge(schemaAttendeeCreateParams);
|
2022-04-26 20:23:33 +00:00
|
|
|
|
|
|
|
export const schemaAttendeeReadPublic = Attendee.pick({
|
2022-04-27 17:25:36 +00:00
|
|
|
id: true,
|
2022-04-26 20:23:33 +00:00
|
|
|
bookingId: true,
|
|
|
|
name: true,
|
|
|
|
email: true,
|
|
|
|
timeZone: true,
|
|
|
|
});
|