Co-authored-by: Keith Williams <keithwillcode@gmail.com> Co-authored-by: Omar López <zomars@me.com> Co-authored-by: Amit Sharma <74371312+Amit91848@users.noreply.github.com>
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",
|
|
});
|