Skip to content

Scheduling infrastructure for absolutely everyone.

Second go at removing Zod generated classes from our repo (#1946)

Alex van Andel652c2e342fce
diff --git a/.gitignore b/.gitignore
index ea33396e7f2..5780dbbccab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,5 +59,9 @@ yarn-error.log*
# Typescript
tsconfig.tsbuildinfo
+
# turbo
-.turbo
\ No newline at end of file
+.turbo
+
+# Prisma-Zod
+packages/prisma/zod/*.ts
diff --git a/apps/web/components/eventtype/CreateEventType.tsx b/apps/web/components/eventtype/CreateEventType.tsx
index 03c9272f0c6..1739bbb57a7 100644
--- a/apps/web/components/eventtype/CreateEventType.tsx
+++ b/apps/web/components/eventtype/CreateEventType.tsx
@@ -6,7 +6,7 @@ import React, { useEffect } from "react";
import { useForm } from "react-hook-form";
import type { z } from "zod";
-import { createEventTypeInput } from "@calcom/prisma/zod/eventtypeCustom";
+import { createEventTypeInput } from "@calcom/prisma/zod/custom/eventtype";
import { HttpError } from "@lib/core/http/error";
import { useLocale } from "@lib/hooks/useLocale";
diff --git a/apps/web/server/routers/viewer/eventTypes.tsx b/apps/web/server/routers/viewer/eventTypes.tsx
index b6519406d26..c722a9bc939 100644
--- a/apps/web/server/routers/viewer/eventTypes.tsx
+++ b/apps/web/server/routers/viewer/eventTypes.tsx
@@ -8,7 +8,7 @@ import {
_EventTypeModel,
} from "@calcom/prisma/zod";
import { stringOrNumber } from "@calcom/prisma/zod-utils";
-import { createEventTypeInput } from "@calcom/prisma/zod/eventtypeCustom";
+import { createEventTypeInput } from "@calcom/prisma/zod/custom/eventtype";
import { createProtectedRouter } from "@server/createRouter";
import { viewerRouter } from "@server/routers/viewer";
diff --git a/packages/prisma/zod/attendee.ts b/packages/prisma/zod/attendee.ts
deleted file mode 100644
index 79948035500..00000000000
--- a/packages/prisma/zod/attendee.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { CompleteBooking, BookingModel } from "./index"
-
-export const _AttendeeModel = z.object({
- id: z.number().int(),
- email: z.string(),
- name: z.string(),
- timeZone: z.string(),
- locale: z.string().nullish(),
- bookingId: z.number().int().nullish(),
-})
-
-export interface CompleteAttendee extends z.infer<typeof _AttendeeModel> {
- booking?: CompleteBooking | null
-}
-
-/**
- * AttendeeModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const AttendeeModel: z.ZodSchema<CompleteAttendee> = z.lazy(() => _AttendeeModel.extend({
- booking: BookingModel.nullish(),
-}))
diff --git a/packages/prisma/zod/availability.ts b/packages/prisma/zod/availability.ts
deleted file mode 100644
index e9adc405a80..00000000000
--- a/packages/prisma/zod/availability.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { CompleteUser, UserModel, CompleteEventType, EventTypeModel } from "./index"
-
-export const _AvailabilityModel = z.object({
- id: z.number().int(),
- label: z.string().nullish(),
- userId: z.number().int().nullish(),
- eventTypeId: z.number().int().nullish(),
- days: z.number().int().array(),
- startTime: z.date(),
- endTime: z.date(),
- date: z.date().nullish(),
-})
-
-export interface CompleteAvailability extends z.infer<typeof _AvailabilityModel> {
- user?: CompleteUser | null
- eventType?: CompleteEventType | null
-}
-
-/**
- * AvailabilityModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const AvailabilityModel: z.ZodSchema<CompleteAvailability> = z.lazy(() => _AvailabilityModel.extend({
- user: UserModel.nullish(),
- eventType: EventTypeModel.nullish(),
-}))
diff --git a/packages/prisma/zod/booking.ts b/packages/prisma/zod/booking.ts
deleted file mode 100644
index e00b8e894f7..00000000000
--- a/packages/prisma/zod/booking.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { BookingStatus } from "@prisma/client"
-import { CompleteUser, UserModel, CompleteBookingReference, BookingReferenceModel, CompleteEventType, EventTypeModel, CompleteAttendee, AttendeeModel, CompleteDailyEventReference, DailyEventReferenceModel, CompletePayment, PaymentModel, CompleteDestinationCalendar, DestinationCalendarModel } from "./index"
-
-export const _BookingModel = z.object({
- id: z.number().int(),
- uid: z.string(),
- userId: z.number().int().nullish(),
- eventTypeId: z.number().int().nullish(),
- title: z.string(),
- description: z.string().nullish(),
- startTime: z.date(),
- endTime: z.date(),
- location: z.string().nullish(),
- createdAt: z.date(),
- updatedAt: z.date().nullish(),
- confirmed: z.boolean(),
- rejected: z.boolean(),
- status: z.nativeEnum(BookingStatus),
- paid: z.boolean(),
- cancellationReason: z.string().nullish(),
- rejectionReason: z.string().nullish(),
-})
-
-export interface CompleteBooking extends z.infer<typeof _BookingModel> {
- user?: CompleteUser | null
- references: CompleteBookingReference[]
- eventType?: CompleteEventType | null
- attendees: CompleteAttendee[]
- dailyRef?: CompleteDailyEventReference | null
- payment: CompletePayment[]
- destinationCalendar?: CompleteDestinationCalendar | null
-}
-
-/**
- * BookingModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const BookingModel: z.ZodSchema<CompleteBooking> = z.lazy(() => _BookingModel.extend({
- user: UserModel.nullish(),
- references: BookingReferenceModel.array(),
- eventType: EventTypeModel.nullish(),
- attendees: AttendeeModel.array(),
- dailyRef: DailyEventReferenceModel.nullish(),
- payment: PaymentModel.array(),
- destinationCalendar: DestinationCalendarModel.nullish(),
-}))
diff --git a/packages/prisma/zod/bookingreference.ts b/packages/prisma/zod/bookingreference.ts
deleted file mode 100644
index 3f0ace2a618..00000000000
--- a/packages/prisma/zod/bookingreference.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { CompleteBooking, BookingModel } from "./index"
-
-export const _BookingReferenceModel = z.object({
- id: z.number().int(),
- type: z.string(),
- uid: z.string(),
- meetingId: z.string().nullish(),
- meetingPassword: z.string().nullish(),
- meetingUrl: z.string().nullish(),
- bookingId: z.number().int().nullish(),
-})
-
-export interface CompleteBookingReference extends z.infer<typeof _BookingReferenceModel> {
- booking?: CompleteBooking | null
-}
-
-/**
- * BookingReferenceModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const BookingReferenceModel: z.ZodSchema<CompleteBookingReference> = z.lazy(() => _BookingReferenceModel.extend({
- booking: BookingModel.nullish(),
-}))
diff --git a/packages/prisma/zod/credential.ts b/packages/prisma/zod/credential.ts
deleted file mode 100644
index af4371e1441..00000000000
--- a/packages/prisma/zod/credential.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { CompleteUser, UserModel } from "./index"
-
-// Helper schema for JSON fields
-type Literal = boolean | number | string
-type Json = Literal | { [key: string]: Json } | Json[]
-const literalSchema = z.union([z.string(), z.number(), z.boolean()])
-const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))
-
-export const _CredentialModel = z.object({
- id: z.number().int(),
- type: z.string(),
- key: jsonSchema,
- userId: z.number().int().nullish(),
-})
-
-export interface CompleteCredential extends z.infer<typeof _CredentialModel> {
- user?: CompleteUser | null
-}
-
-/**
- * CredentialModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const CredentialModel: z.ZodSchema<CompleteCredential> = z.lazy(() => _CredentialModel.extend({
- user: UserModel.nullish(),
-}))
diff --git a/packages/prisma/zod/custom/eventtype.ts b/packages/prisma/zod/custom/eventtype.ts
new file mode 100644
index 00000000000..ee13e2d2430
--- /dev/null
+++ b/packages/prisma/zod/custom/eventtype.ts
@@ -0,0 +1,15 @@
+import { _EventTypeModel } from "../eventtype";
+
+export const createEventTypeInput = _EventTypeModel
+ .pick({
+ title: true,
+ slug: true,
+ description: true,
+ length: true,
+ teamId: true,
+ schedulingType: true,
+ })
+ .refine((data) => (data.teamId ? data.teamId && data.schedulingType : true), {
+ path: ["schedulingType"],
+ message: "You must select a scheduling type for team events",
+ });
\ No newline at end of file
diff --git a/packages/prisma/zod/dailyeventreference.ts b/packages/prisma/zod/dailyeventreference.ts
deleted file mode 100644
index 93ed654efbd..00000000000
--- a/packages/prisma/zod/dailyeventreference.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { CompleteBooking, BookingModel } from "./index"
-
-export const _DailyEventReferenceModel = z.object({
- id: z.number().int(),
- dailyurl: z.string(),
- dailytoken: z.string(),
- bookingId: z.number().int().nullish(),
-})
-
-export interface CompleteDailyEventReference extends z.infer<typeof _DailyEventReferenceModel> {
- booking?: CompleteBooking | null
-}
-
-/**
- * DailyEventReferenceModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const DailyEventReferenceModel: z.ZodSchema<CompleteDailyEventReference> = z.lazy(() => _DailyEventReferenceModel.extend({
- booking: BookingModel.nullish(),
-}))
diff --git a/packages/prisma/zod/destinationcalendar.ts b/packages/prisma/zod/destinationcalendar.ts
deleted file mode 100644
index 4160bdfca58..00000000000
--- a/packages/prisma/zod/destinationcalendar.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { CompleteUser, UserModel, CompleteBooking, BookingModel, CompleteEventType, EventTypeModel } from "./index"
-
-export const _DestinationCalendarModel = z.object({
- id: z.number().int(),
- integration: z.string(),
- externalId: z.string(),
- userId: z.number().int().nullish(),
- bookingId: z.number().int().nullish(),
- eventTypeId: z.number().int().nullish(),
-})
-
-export interface CompleteDestinationCalendar extends z.infer<typeof _DestinationCalendarModel> {
- user?: CompleteUser | null
- booking?: CompleteBooking | null
- eventType?: CompleteEventType | null
-}
-
-/**
- * DestinationCalendarModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const DestinationCalendarModel: z.ZodSchema<CompleteDestinationCalendar> = z.lazy(() => _DestinationCalendarModel.extend({
- user: UserModel.nullish(),
- booking: BookingModel.nullish(),
- eventType: EventTypeModel.nullish(),
-}))
diff --git a/packages/prisma/zod/eventtype.ts b/packages/prisma/zod/eventtype.ts
deleted file mode 100644
index 33000ad6287..00000000000
--- a/packages/prisma/zod/eventtype.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { PeriodType, SchedulingType } from "@prisma/client"
-import { CompleteUser, UserModel, CompleteTeam, TeamModel, CompleteBooking, BookingModel, CompleteAvailability, AvailabilityModel, CompleteDestinationCalendar, DestinationCalendarModel, CompleteEventTypeCustomInput, EventTypeCustomInputModel, CompleteSchedule, ScheduleModel } from "./index"
-
-// Helper schema for JSON fields
-type Literal = boolean | number | string
-type Json = Literal | { [key: string]: Json } | Json[]
-const literalSchema = z.union([z.string(), z.number(), z.boolean()])
-const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))
-
-export const _EventTypeModel = z.object({
- id: z.number().int(),
- title: z.string().nonempty(),
- slug: imports.eventTypeSlug,
- description: z.string().nullish(),
- position: z.number().int(),
- locations: imports.eventTypeLocations,
- length: z.number().int(),
- hidden: z.boolean(),
- userId: z.number().int().nullish(),
- teamId: z.number().int().nullish(),
- eventName: z.string().nullish(),
- timeZone: z.string().nullish(),
- periodType: z.nativeEnum(PeriodType),
- periodStartDate: z.date().nullish(),
- periodEndDate: z.date().nullish(),
- periodDays: z.number().int().nullish(),
- periodCountCalendarDays: z.boolean().nullish(),
- requiresConfirmation: z.boolean(),
- disableGuests: z.boolean(),
- minimumBookingNotice: z.number().int(),
- schedulingType: z.nativeEnum(SchedulingType).nullish(),
- price: z.number().int(),
- currency: z.string(),
- slotInterval: z.number().int().nullish(),
- metadata: jsonSchema,
-})
-
-export interface CompleteEventType extends z.infer<typeof _EventTypeModel> {
- users: CompleteUser[]
- team?: CompleteTeam | null
- bookings: CompleteBooking[]
- availability: CompleteAvailability[]
- destinationCalendar?: CompleteDestinationCalendar | null
- customInputs: CompleteEventTypeCustomInput[]
- Schedule: CompleteSchedule[]
-}
-
-/**
- * EventTypeModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const EventTypeModel: z.ZodSchema<CompleteEventType> = z.lazy(() => _EventTypeModel.extend({
- users: UserModel.array(),
- team: TeamModel.nullish(),
- bookings: BookingModel.array(),
- availability: AvailabilityModel.array(),
- destinationCalendar: DestinationCalendarModel.nullish(),
- customInputs: EventTypeCustomInputModel.array(),
- Schedule: ScheduleModel.array(),
-}))
diff --git a/packages/prisma/zod/eventtypeCustom.ts b/packages/prisma/zod/eventtypeCustom.ts
deleted file mode 100644
index 0f9c1e6f8d9..00000000000
--- a/packages/prisma/zod/eventtypeCustom.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { _EventTypeModel } from "./eventtype";
-
-const createEventTypeBaseInput = _EventTypeModel
- .pick({
- title: true,
- slug: true,
- description: true,
- length: true,
- teamId: true,
- schedulingType: true,
- })
- .refine((data) => (data.teamId ? data.teamId && data.schedulingType : true), {
- path: ["schedulingType"],
- message: "You must select a scheduling type for team events",
- });
-
-export const createEventTypeInput = createEventTypeBaseInput;
diff --git a/packages/prisma/zod/eventtypecustominput.ts b/packages/prisma/zod/eventtypecustominput.ts
deleted file mode 100644
index 04535b146e7..00000000000
--- a/packages/prisma/zod/eventtypecustominput.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { EventTypeCustomInputType } from "@prisma/client"
-import { CompleteEventType, EventTypeModel } from "./index"
-
-export const _EventTypeCustomInputModel = z.object({
- id: z.number().int(),
- eventTypeId: z.number().int(),
- label: z.string(),
- type: z.nativeEnum(EventTypeCustomInputType),
- required: z.boolean(),
- placeholder: z.string(),
-})
-
-export interface CompleteEventTypeCustomInput extends z.infer<typeof _EventTypeCustomInputModel> {
- eventType: CompleteEventType
-}
-
-/**
- * EventTypeCustomInputModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const EventTypeCustomInputModel: z.ZodSchema<CompleteEventTypeCustomInput> = z.lazy(() => _EventTypeCustomInputModel.extend({
- eventType: EventTypeModel,
-}))
diff --git a/packages/prisma/zod/index.ts b/packages/prisma/zod/index.ts
deleted file mode 100644
index a4a8226e067..00000000000
--- a/packages/prisma/zod/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-export * from "./eventtype"
-export * from "./credential"
-export * from "./destinationcalendar"
-export * from "./user"
-export * from "./team"
-export * from "./membership"
-export * from "./verificationrequest"
-export * from "./bookingreference"
-export * from "./attendee"
-export * from "./dailyeventreference"
-export * from "./booking"
-export * from "./schedule"
-export * from "./availability"
-export * from "./selectedcalendar"
-export * from "./eventtypecustominput"
-export * from "./resetpasswordrequest"
-export * from "./remindermail"
-export * from "./payment"
-export * from "./webhook"
diff --git a/packages/prisma/zod/membership.ts b/packages/prisma/zod/membership.ts
deleted file mode 100644
index f2562814660..00000000000
--- a/packages/prisma/zod/membership.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { MembershipRole } from "@prisma/client"
-import { CompleteTeam, TeamModel, CompleteUser, UserModel } from "./index"
-
-export const _MembershipModel = z.object({
- teamId: z.number().int(),
- userId: z.number().int(),
- accepted: z.boolean(),
- role: z.nativeEnum(MembershipRole),
-})
-
-export interface CompleteMembership extends z.infer<typeof _MembershipModel> {
- team: CompleteTeam
- user: CompleteUser
-}
-
-/**
- * MembershipModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const MembershipModel: z.ZodSchema<CompleteMembership> = z.lazy(() => _MembershipModel.extend({
- team: TeamModel,
- user: UserModel,
-}))
diff --git a/packages/prisma/zod/payment.ts b/packages/prisma/zod/payment.ts
deleted file mode 100644
index 7fe5172ce14..00000000000
--- a/packages/prisma/zod/payment.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { PaymentType } from "@prisma/client"
-import { CompleteBooking, BookingModel } from "./index"
-
-// Helper schema for JSON fields
-type Literal = boolean | number | string
-type Json = Literal | { [key: string]: Json } | Json[]
-const literalSchema = z.union([z.string(), z.number(), z.boolean()])
-const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))
-
-export const _PaymentModel = z.object({
- id: z.number().int(),
- uid: z.string(),
- type: z.nativeEnum(PaymentType),
- bookingId: z.number().int(),
- amount: z.number().int(),
- fee: z.number().int(),
- currency: z.string(),
- success: z.boolean(),
- refunded: z.boolean(),
- data: jsonSchema,
- externalId: z.string(),
-})
-
-export interface CompletePayment extends z.infer<typeof _PaymentModel> {
- booking?: CompleteBooking | null
-}
-
-/**
- * PaymentModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const PaymentModel: z.ZodSchema<CompletePayment> = z.lazy(() => _PaymentModel.extend({
- booking: BookingModel.nullish(),
-}))
diff --git a/packages/prisma/zod/remindermail.ts b/packages/prisma/zod/remindermail.ts
deleted file mode 100644
index 3a74896de45..00000000000
--- a/packages/prisma/zod/remindermail.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { ReminderType } from "@prisma/client"
-
-export const _ReminderMailModel = z.object({
- id: z.number().int(),
- referenceId: z.number().int(),
- reminderType: z.nativeEnum(ReminderType),
- elapsedMinutes: z.number().int(),
- createdAt: z.date(),
-})
diff --git a/packages/prisma/zod/resetpasswordrequest.ts b/packages/prisma/zod/resetpasswordrequest.ts
deleted file mode 100644
index c6e8a422476..00000000000
--- a/packages/prisma/zod/resetpasswordrequest.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-
-export const _ResetPasswordRequestModel = z.object({
- id: z.string(),
- createdAt: z.date(),
- updatedAt: z.date(),
- email: z.string(),
- expires: z.date(),
-})
diff --git a/packages/prisma/zod/schedule.ts b/packages/prisma/zod/schedule.ts
deleted file mode 100644
index d5c35dc6643..00000000000
--- a/packages/prisma/zod/schedule.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { CompleteUser, UserModel, CompleteEventType, EventTypeModel } from "./index"
-
-// Helper schema for JSON fields
-type Literal = boolean | number | string
-type Json = Literal | { [key: string]: Json } | Json[]
-const literalSchema = z.union([z.string(), z.number(), z.boolean()])
-const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))
-
-export const _ScheduleModel = z.object({
- id: z.number().int(),
- userId: z.number().int().nullish(),
- eventTypeId: z.number().int().nullish(),
- title: z.string().nullish(),
- freeBusyTimes: jsonSchema,
-})
-
-export interface CompleteSchedule extends z.infer<typeof _ScheduleModel> {
- user?: CompleteUser | null
- eventType?: CompleteEventType | null
-}
-
-/**
- * ScheduleModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const ScheduleModel: z.ZodSchema<CompleteSchedule> = z.lazy(() => _ScheduleModel.extend({
- user: UserModel.nullish(),
- eventType: EventTypeModel.nullish(),
-}))
diff --git a/packages/prisma/zod/selectedcalendar.ts b/packages/prisma/zod/selectedcalendar.ts
deleted file mode 100644
index cb09e7e0fce..00000000000
--- a/packages/prisma/zod/selectedcalendar.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { CompleteUser, UserModel } from "./index"
-
-export const _SelectedCalendarModel = z.object({
- userId: z.number().int(),
- integration: z.string(),
- externalId: z.string(),
-})
-
-export interface CompleteSelectedCalendar extends z.infer<typeof _SelectedCalendarModel> {
- user: CompleteUser
-}
-
-/**
- * SelectedCalendarModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const SelectedCalendarModel: z.ZodSchema<CompleteSelectedCalendar> = z.lazy(() => _SelectedCalendarModel.extend({
- user: UserModel,
-}))
diff --git a/packages/prisma/zod/team.ts b/packages/prisma/zod/team.ts
deleted file mode 100644
index 0795d03e587..00000000000
--- a/packages/prisma/zod/team.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { CompleteMembership, MembershipModel, CompleteEventType, EventTypeModel } from "./index"
-
-export const _TeamModel = z.object({
- id: z.number().int(),
- name: z.string().nullish(),
- slug: z.string().nullish(),
- logo: z.string().nullish(),
- bio: z.string().nullish(),
- hideBranding: z.boolean(),
-})
-
-export interface CompleteTeam extends z.infer<typeof _TeamModel> {
- members: CompleteMembership[]
- eventTypes: CompleteEventType[]
-}
-
-/**
- * TeamModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const TeamModel: z.ZodSchema<CompleteTeam> = z.lazy(() => _TeamModel.extend({
- members: MembershipModel.array(),
- eventTypes: EventTypeModel.array(),
-}))
diff --git a/packages/prisma/zod/user.ts b/packages/prisma/zod/user.ts
deleted file mode 100644
index 81c81df87f4..00000000000
--- a/packages/prisma/zod/user.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { IdentityProvider, UserPlan } from "@prisma/client"
-import { CompleteEventType, EventTypeModel, CompleteCredential, CredentialModel, CompleteMembership, MembershipModel, CompleteBooking, BookingModel, CompleteAvailability, AvailabilityModel, CompleteSelectedCalendar, SelectedCalendarModel, CompleteSchedule, ScheduleModel, CompleteWebhook, WebhookModel, CompleteDestinationCalendar, DestinationCalendarModel } from "./index"
-
-// Helper schema for JSON fields
-type Literal = boolean | number | string
-type Json = Literal | { [key: string]: Json } | Json[]
-const literalSchema = z.union([z.string(), z.number(), z.boolean()])
-const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))
-
-export const _UserModel = z.object({
- id: z.number().int(),
- username: z.string().nullish(),
- name: z.string().nullish(),
- email: z.string().email(),
- emailVerified: z.date().nullish(),
- password: z.string().nullish(),
- bio: z.string().nullish(),
- avatar: z.string().nullish(),
- timeZone: z.string(),
- weekStart: z.string(),
- startTime: z.number().int(),
- endTime: z.number().int(),
- bufferTime: z.number().int(),
- hideBranding: z.boolean(),
- theme: z.string().nullish(),
- createdDate: z.date(),
- completedOnboarding: z.boolean(),
- locale: z.string().nullish(),
- twoFactorSecret: z.string().nullish(),
- twoFactorEnabled: z.boolean(),
- identityProvider: z.nativeEnum(IdentityProvider),
- identityProviderId: z.string().nullish(),
- invitedTo: z.number().int().nullish(),
- plan: z.nativeEnum(UserPlan),
- brandColor: z.string(),
- away: z.boolean(),
- metadata: jsonSchema,
- verified: z.boolean().nullish(),
-})
-
-export interface CompleteUser extends z.infer<typeof _UserModel> {
- eventTypes: CompleteEventType[]
- credentials: CompleteCredential[]
- teams: CompleteMembership[]
- bookings: CompleteBooking[]
- availability: CompleteAvailability[]
- selectedCalendars: CompleteSelectedCalendar[]
- Schedule: CompleteSchedule[]
- webhooks: CompleteWebhook[]
- destinationCalendar?: CompleteDestinationCalendar | null
-}
-
-/**
- * UserModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const UserModel: z.ZodSchema<CompleteUser> = z.lazy(() => _UserModel.extend({
- eventTypes: EventTypeModel.array(),
- credentials: CredentialModel.array(),
- teams: MembershipModel.array(),
- bookings: BookingModel.array(),
- availability: AvailabilityModel.array(),
- selectedCalendars: SelectedCalendarModel.array(),
- Schedule: ScheduleModel.array(),
- webhooks: WebhookModel.array(),
- destinationCalendar: DestinationCalendarModel.nullish(),
-}))
diff --git a/packages/prisma/zod/verificationrequest.ts b/packages/prisma/zod/verificationrequest.ts
deleted file mode 100644
index b9a7281df3d..00000000000
--- a/packages/prisma/zod/verificationrequest.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-
-export const _VerificationRequestModel = z.object({
- id: z.number().int(),
- identifier: z.string(),
- token: z.string(),
- expires: z.date(),
- createdAt: z.date(),
- updatedAt: z.date(),
-})
diff --git a/packages/prisma/zod/webhook.ts b/packages/prisma/zod/webhook.ts
deleted file mode 100644
index 4d564e3a545..00000000000
--- a/packages/prisma/zod/webhook.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import * as z from "zod"
-import * as imports from "../zod-utils"
-import { WebhookTriggerEvents } from "@prisma/client"
-import { CompleteUser, UserModel } from "./index"
-
-export const _WebhookModel = z.object({
- id: z.string(),
- userId: z.number().int(),
- subscriberUrl: z.string(),
- payloadTemplate: z.string().nullish(),
- createdAt: z.date(),
- active: z.boolean(),
- eventTriggers: z.nativeEnum(WebhookTriggerEvents).array(),
-})
-
-export interface CompleteWebhook extends z.infer<typeof _WebhookModel> {
- user: CompleteUser
-}
-
-/**
- * WebhookModel contains all relations on your model in addition to the scalars
- *
- * NOTE: Lazy required in case of potential circular dependencies within schema
- */
-export const WebhookModel: z.ZodSchema<CompleteWebhook> = z.lazy(() => _WebhookModel.extend({
- user: UserModel,
-}))