cal.pub0.org/lib/validations/selected-calendar.ts

26 lines
791 B
TypeScript
Raw Normal View History

2022-04-01 23:55:41 +00:00
import { z } from "zod";
import { _SelectedCalendarModel as SelectedCalendar } from "@calcom/prisma/zod";
2022-04-01 23:55:41 +00:00
export const schemaSelectedCalendarBaseBodyParams = SelectedCalendar.omit({ userId: true }).partial();
2022-04-01 23:55:41 +00:00
export const schemaSelectedCalendarPublic = SelectedCalendar.omit({});
const schemaSelectedCalendarRequiredParams = z.object({
externalId: z.string(),
integration: z.string(),
user: z.object({
connect: z.object({
id: z.number().optional(),
username: z.string().optional(),
email: z.string().optional(),
}),
// FIXME: Provide valid UserModel schema here, but not sure how yet.
2022-04-01 23:55:41 +00:00
create: z.any(),
}),
});
export const schemaSelectedCalendarBodyParams = schemaSelectedCalendarBaseBodyParams.merge(
schemaSelectedCalendarRequiredParams
);