cal.pub0.org/lib/validations/schedule.ts

24 lines
653 B
TypeScript

import { withValidation } from "next-validations";
import { z } from "zod";
import { _ScheduleModel as Schedule } from "@calcom/prisma/zod";
// import { jsonSchema } from "./shared/jsonSchema";
const schemaScheduleBaseBodyParams = Schedule.omit({ id: true }).partial();
const schemaScheduleRequiredParams = z.object({
userId: z.number(),
name: z.string(),
});
export const schemaScheduleBodyParams = schemaScheduleBaseBodyParams.merge(schemaScheduleRequiredParams);
export const schemaSchedulePublic = Schedule.omit({});
export const withValidSchedule = withValidation({
schema: schemaScheduleBodyParams,
type: "Zod",
mode: "body",
});