Circular dependecy hotfix

pull/6375/head
zomars 2023-01-06 13:15:11 -07:00
parent e5b6a3332e
commit a0709fac88
1 changed files with 15 additions and 12 deletions

View File

@ -1,15 +1,18 @@
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), {