sendou.ink/app/features/team/team-schemas.ts
2026-01-18 18:21:19 +02:00

18 lines
496 B
TypeScript

import { z } from "zod";
import { textFieldRequired } from "~/form/fields";
import { mySlugify } from "~/utils/urls";
import { TEAM } from "./team-constants";
export const createTeamSchema = z.object({
name: textFieldRequired({
label: "labels.name",
minLength: TEAM.NAME_MIN_LENGTH,
maxLength: TEAM.NAME_MAX_LENGTH,
validate: {
func: (teamName) =>
mySlugify(teamName).length > 0 && mySlugify(teamName) !== "new",
message: "forms:errors.noOnlySpecialCharacters",
},
}),
});