fix: build and validations for event-type, bring back req extension
parent
29deb1fd3c
commit
b755d2bd71
|
@ -12,7 +12,7 @@ declare module "next" {
|
||||||
body: Body;
|
body: Body;
|
||||||
method: string;
|
method: string;
|
||||||
query: {
|
query: {
|
||||||
apiKey: string;
|
apiKey?: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ export type EventTypeCustomInputsResponse = BaseResponse & {
|
||||||
event_type_custom_inputs?: Partial<EventTypeCustomInput>[];
|
event_type_custom_inputs?: Partial<EventTypeCustomInput>[];
|
||||||
};
|
};
|
||||||
// From rrule https://jakubroztocil.github.io/rrule freq
|
// From rrule https://jakubroztocil.github.io/rrule freq
|
||||||
enum Frequency {
|
export enum Frequency {
|
||||||
"YEARLY",
|
"YEARLY",
|
||||||
"MONTHLY",
|
"MONTHLY",
|
||||||
"WEEKLY",
|
"WEEKLY",
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
|
import { AppStoreLocationType, DefaultLocationType } from "@calcom/app-store/locations";
|
||||||
import { _EventTypeModel as EventType } from "@calcom/prisma/zod";
|
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";
|
import { jsonSchema } from "./shared/jsonSchema";
|
||||||
|
|
||||||
export const schemaEventTypeBaseBodyParams = EventType.pick({
|
export const schemaEventTypeBaseBodyParams = EventType.pick({
|
||||||
|
@ -89,8 +93,24 @@ export const schemaEventTypeReadPublic = EventType.pick({
|
||||||
metadata: true,
|
metadata: true,
|
||||||
}).merge(
|
}).merge(
|
||||||
z.object({
|
z.object({
|
||||||
recurringEvent: jsonSchema.nullable(),
|
// { dtstart?: Date | undefined; interval?: number | undefined; count?: number | undefined; freq?: Frequency | undefined; until?: Date | undefined; tzid?: string | undefined; } | undefined'
|
||||||
locations: z.array(jsonSchema).nullable(),
|
// 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(),
|
metadata: jsonSchema.nullable(),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue