2022-03-26 23:58:22 +00:00
|
|
|
import { withValidation } from "next-validations";
|
2022-04-01 21:03:03 +00:00
|
|
|
import { z } from "zod";
|
2022-03-26 23:58:22 +00:00
|
|
|
|
2022-03-30 15:37:51 +00:00
|
|
|
import { _BookingReferenceModel as BookingReference } from "@calcom/prisma/zod";
|
|
|
|
|
2022-04-01 21:03:03 +00:00
|
|
|
export const schemaBookingReferenceBaseBodyParams = BookingReference.omit({ id: true }).partial();
|
2022-03-30 15:37:51 +00:00
|
|
|
|
|
|
|
export const schemaBookingReferencePublic = BookingReference.omit({});
|
|
|
|
|
2022-04-01 21:03:03 +00:00
|
|
|
const schemaBookingReferenceRequiredParams = z.object({
|
|
|
|
type: z.string(),
|
|
|
|
uid: z.string(),
|
|
|
|
});
|
|
|
|
|
|
|
|
export const schemaBookingReferenceBodyParams = schemaBookingReferenceBaseBodyParams.merge(
|
|
|
|
schemaBookingReferenceRequiredParams
|
|
|
|
);
|
|
|
|
|
2022-03-30 15:37:51 +00:00
|
|
|
export const withValidBookingReference = withValidation({
|
|
|
|
schema: schemaBookingReferenceBodyParams,
|
2022-03-26 23:58:22 +00:00
|
|
|
type: "Zod",
|
|
|
|
mode: "body",
|
|
|
|
});
|