diff --git a/packages/prisma/zod/custom/eventtype.ts b/packages/prisma/zod/custom/eventtype.ts index 884fc8cc8f..ad21fe3680 100755 --- a/packages/prisma/zod/custom/eventtype.ts +++ b/packages/prisma/zod/custom/eventtype.ts @@ -1,16 +1,19 @@ -import { _EventTypeModel } from "../eventtype"; +import { SchedulingType } from "@prisma/client"; +import { z } from "zod"; +import * as imports from "../../zod-utils"; +// TODO: figure out why EventTypeModel is being called even if it's not imported here, causing a circular dependency +// import { _EventTypeModel } from "../eventtype"; -export const createEventTypeInput = _EventTypeModel - .pick({ - title: true, - slug: true, - description: true, - length: true, - teamId: true, - schedulingType: true, - hidden: true, - locations: true - }) +export const createEventTypeInput = z.object({ + title: z.string().min(1), + slug: imports.eventTypeSlug, + description: z.string().nullish(), + length: z.number().int(), + hidden: z.boolean(), + teamId: z.number().int().nullish(), + schedulingType: z.nativeEnum(SchedulingType).nullish(), + locations: imports.eventTypeLocations, +}) .partial({ hidden: true, locations: true }) .refine((data) => (data.teamId ? data.teamId && data.schedulingType : true), { path: ["schedulingType"],