2022-01-21 21:35:31 +00:00
|
|
|
import { z } from "zod";
|
|
|
|
|
2022-02-21 18:45:35 +00:00
|
|
|
import { LocationType } from "@calcom/lib/location";
|
|
|
|
import { slugify } from "@calcom/lib/slugify";
|
2022-01-21 21:35:31 +00:00
|
|
|
|
|
|
|
export const eventTypeLocations = z.array(
|
2022-03-13 15:56:56 +00:00
|
|
|
z.object({
|
|
|
|
type: z.nativeEnum(LocationType),
|
|
|
|
address: z.string().optional(),
|
|
|
|
link: z.string().url().optional(),
|
|
|
|
})
|
2022-01-21 21:35:31 +00:00
|
|
|
);
|
|
|
|
|
2022-02-21 16:53:16 +00:00
|
|
|
export const eventTypeSlug = z.string().transform((val) => slugify(val.trim()));
|
2022-01-21 21:35:31 +00:00
|
|
|
export const stringToDate = z.string().transform((a) => new Date(a));
|
|
|
|
export const stringOrNumber = z.union([z.string().transform((v) => parseInt(v, 10)), z.number().int()]);
|