validation
This commit is contained in:
1 parent
af4c9d8f91
commit
b6004241e7
8 files changed
+113
-10
No files matched your search
@@ -1,18 +1,17 @@
|
||||
import { z } from "zod";
|
||||
|
||||
const NAME_PATTERN = /^[A-Za-z'-]+$/;
|
||||
import { namePattern } from "@/Validation/patterns";
|
||||
|
||||
export const profileSchema = z.object({
|
||||
firstName: z
|
||||
.string()
|
||||
.min(1, "First name is required")
|
||||
.max(50, "First name must be 50 characters or less")
|
||||
.regex(NAME_PATTERN, "First name can only contain letters, hyphens, and apostrophes"),
|
||||
.regex(namePattern, "First name contains invalid characters"),
|
||||
lastName: z
|
||||
.string()
|
||||
.min(1, "Last name is required")
|
||||
.max(50, "Last name must be 50 characters or less")
|
||||
.regex(NAME_PATTERN, "Last name can only contain letters, hyphens, and apostrophes"),
|
||||
.regex(namePattern, "Last name contains invalid characters"),
|
||||
profileImage: z.instanceof(File).optional().nullable(),
|
||||
deleteProfileImage: z.boolean().optional(),
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user