* refactor: replace timeZone string validation with timeZoneSchema - Replace all instances of timeZone: z.string() with timeZoneSchema - Preserve modifiers (.optional(), .default(), .nullish()) where present - Fix VideoApiAdapter to use organizer's timezone value - Remove redundant isSupportedTimeZone import from booking.ts - Add timeZoneSchema import where needed * Update index.ts * fix: conflicts Signed-off-by: Omar López <zomars@me.com> * Update yarn.lock * Discard changes to yarn.lock * Update booking.ts * Discard changes to packages/platform/types/me.ts * Discard changes to packages/platform/types/me/outputs/me.ts * Discard changes to packages/platform/types/schedules/schedules-2024-04-15/schedules.ts * Discard changes to packages/features/ee/cal-ai-phone/zod-utils.ts --------- Signed-off-by: Omar López <zomars@me.com>
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
import { z } from "zod";
|
|
|
|
import { FULL_NAME_LENGTH_MAX_LIMIT } from "@calcom/lib/constants";
|
|
import { timeZoneSchema } from "@calcom/lib/dayjs/timeZone.schema";
|
|
import { bookerLayouts, userMetadata } from "@calcom/prisma/zod-utils";
|
|
|
|
export const updateUserMetadataAllowedKeys = z.object({
|
|
sessionTimeout: z.number().optional(), // Minutes
|
|
defaultBookerLayouts: bookerLayouts.optional(),
|
|
});
|
|
|
|
export const ZUpdateProfileInputSchema = z.object({
|
|
username: z.string().optional(),
|
|
name: z.string().max(FULL_NAME_LENGTH_MAX_LIMIT).optional(),
|
|
email: z.string().optional(),
|
|
bio: z.string().optional(),
|
|
avatarUrl: z.string().nullable().optional(),
|
|
timeZone: timeZoneSchema.optional(),
|
|
weekStart: z.string().optional(),
|
|
hideBranding: z.boolean().optional(),
|
|
allowDynamicBooking: z.boolean().optional(),
|
|
allowSEOIndexing: z.boolean().optional(),
|
|
receiveMonthlyDigestEmail: z.boolean().optional(),
|
|
brandColor: z.string().optional(),
|
|
darkBrandColor: z.string().optional(),
|
|
theme: z.string().optional().nullable(),
|
|
appTheme: z.string().optional().nullable(),
|
|
completedOnboarding: z.boolean().optional(),
|
|
locale: z.string().optional(),
|
|
timeFormat: z.number().optional(),
|
|
disableImpersonation: z.boolean().optional(),
|
|
metadata: userMetadata.optional(),
|
|
travelSchedules: z
|
|
.array(
|
|
z.object({
|
|
id: z.number().optional(),
|
|
timeZone: timeZoneSchema,
|
|
endDate: z.date().optional(),
|
|
startDate: z.date(),
|
|
})
|
|
)
|
|
.optional(),
|
|
secondaryEmails: z
|
|
.array(
|
|
z.object({
|
|
id: z.number(),
|
|
email: z.string(),
|
|
isDeleted: z.boolean().default(false),
|
|
})
|
|
)
|
|
.optional(),
|
|
});
|
|
|
|
export type TUpdateProfileInputSchema = z.infer<typeof ZUpdateProfileInputSchema>;
|