mirror of
https://github.com/hanzoai/calendar.git
synced 2026-09-24 22:42:24 +00:00
Co-authored-by: Keith Williams <[email protected]> Co-authored-by: Omar López <[email protected]> Co-authored-by: Amit Sharma <[email protected]>
23 lines
627 B
TypeScript
23 lines
627 B
TypeScript
import { withValidation } from "next-validations";
|
|
import { z } from "zod";
|
|
|
|
import { emailSchema } from "@calcom/lib/emailSchema";
|
|
|
|
import { baseApiParams } from "./baseApiParams";
|
|
|
|
// Extracted out as utility function so can be reused
|
|
// at different endpoints that require this validation.
|
|
export const schemaQueryUserEmail = baseApiParams.extend({
|
|
email: emailSchema,
|
|
});
|
|
|
|
export const schemaQuerySingleOrMultipleUserEmails = z.object({
|
|
email: z.union([emailSchema, z.array(emailSchema)]),
|
|
});
|
|
|
|
export const withValidQueryUserEmail = withValidation({
|
|
schema: schemaQueryUserEmail,
|
|
type: "Zod",
|
|
mode: "query",
|
|
});
|