diff --git a/lib/helpers/verifyApiKey.ts b/lib/helpers/verifyApiKey.ts index feba710c5b..67ad05c8ac 100644 --- a/lib/helpers/verifyApiKey.ts +++ b/lib/helpers/verifyApiKey.ts @@ -12,7 +12,7 @@ declare module "next" { body: Body; method: string; query: { - apiKey: string; + apiKey?: string; }; } } diff --git a/lib/types.ts b/lib/types.ts index 6018019abc..f61e5d7f1c 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -125,7 +125,7 @@ export type EventTypeCustomInputsResponse = BaseResponse & { event_type_custom_inputs?: Partial[]; }; // From rrule https://jakubroztocil.github.io/rrule freq -enum Frequency { +export enum Frequency { "YEARLY", "MONTHLY", "WEEKLY", diff --git a/lib/validations/event-type.ts b/lib/validations/event-type.ts index ff11d4fcd9..e3a6d83228 100644 --- a/lib/validations/event-type.ts +++ b/lib/validations/event-type.ts @@ -1,7 +1,11 @@ import { z } from "zod"; +import { AppStoreLocationType, DefaultLocationType } from "@calcom/app-store/locations"; import { _EventTypeModel as EventType } from "@calcom/prisma/zod"; +import { Frequency } from "@lib/types"; +import { timeZone } from "@lib/validations/shared/timeZone"; + import { jsonSchema } from "./shared/jsonSchema"; export const schemaEventTypeBaseBodyParams = EventType.pick({ @@ -89,8 +93,24 @@ export const schemaEventTypeReadPublic = EventType.pick({ metadata: true, }).merge( z.object({ - recurringEvent: jsonSchema.nullable(), - locations: z.array(jsonSchema).nullable(), + // { dtstart?: Date | undefined; interval?: number | undefined; count?: number | undefined; freq?: Frequency | undefined; until?: Date | undefined; tzid?: string | undefined; } | undefined' + // recurringEvent: jsonSchema.nullable(), + recurringEvent: z.object({ + dtstart: z.date().optional(), + interval: z.number().int().optional(), + count: z.number().int().optional(), + freq: z.nativeEnum(Frequency).optional(), + until: z.date().optional(), + tzid: timeZone, + }), + locations: z.array( + z.object({ + link: z.string().optional(), + address: z.string().optional(), + hostPhoneNumber: z.string().optional(), + type: z.nativeEnum(DefaultLocationType).or(z.nativeEnum(AppStoreLocationType)), + }) + ), metadata: jsonSchema.nullable(), }) );