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

20 lines
504 B
TypeScript

import { withValidation } from "next-validations";
import { z } from "zod";
const schemaTeam = z
.object({
slug: z.string().min(3),
name: z.string().min(3),
hideBranding: z.boolean().default(false),
bio: z.string().min(3).optional(),
logo: z.string().optional(),
})
.strict(); // Adding strict so that we can disallow passing in extra fields
const withValidTeam = withValidation({
schema: schemaTeam,
type: "Zod",
mode: "body",
});
export { schemaTeam, withValidTeam };