Files
calendar/lib/validations/eventType.ts
T

19 lines
522 B
TypeScript

import { withValidation } from "next-validations";
import { z } from "zod";
const schemaEventType = z
.object({
title: z.string().min(3),
slug: z.string().min(3),
length: z.number().min(1).max(1440), // max is a full day.
description: z.string().min(3).optional(),
})
.strict(); // Adding strict so that we can disallow passing in extra fields
const withValidEventType = withValidation({
schema: schemaEventType,
type: "Zod",
mode: "body",
});
export { schemaEventType, withValidEventType };