-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
37 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
import * as z from "zod" | ||
import * as z from "zod"; | ||
import { FrontendUser } from "./User"; | ||
|
||
export const userSchema: z.ZodType<Partial<FrontendUser>> = z.object({ | ||
first_name: z | ||
.string() | ||
.min(2, "First name should be at least two characters long"), | ||
last_name: z | ||
.string() | ||
.min(2, "Last name should be at least two characters long"), | ||
country: z | ||
.string() | ||
.length(2, "Country code should be 2 characters long") | ||
.toUpperCase(), | ||
// profile_picture: z | ||
// .any() | ||
// .refine((obj) => (!obj ? "Profile picture is required" : "")) | ||
// .refine((obj) => obj && obj.length <= 0, "Profile picture not provided") | ||
// .transform((obj) => { | ||
// if (obj && obj.length > 0 && (obj as FileList)[0].size <= 5 * 1024 * 1024) { | ||
// return (obj as FileList)[0].name; | ||
// } else { | ||
// throw new Error("File is too big (>5 MB)"); | ||
// } | ||
// }), | ||
mail: z.string().email(), | ||
password: z | ||
.string() | ||
.min(8, "Password should be at least eight characters long"), | ||
}); | ||
first_name: z | ||
.string() | ||
.min(2, "First name should be at least two characters long"), | ||
last_name: z | ||
.string() | ||
.min(2, "Last name should be at least two characters long"), | ||
country: z | ||
.string() | ||
.length(2, "Country code should be 2 characters long") | ||
.toUpperCase(), | ||
// profile_picture: z | ||
// .any() | ||
// .refine((obj) => (!obj ? "Profile picture is required" : "")) | ||
// .refine((obj) => obj && obj.length <= 0, "Profile picture not provided") | ||
// .transform((obj) => { | ||
// if (obj && obj.length > 0 && (obj as FileList)[0].size <= 5 * 1024 * 1024) { | ||
// return (obj as FileList)[0].name; | ||
// } else { | ||
// throw new Error("File is too big (>5 MB)"); | ||
// } | ||
// }), | ||
mail: z.string().email(), | ||
password: z | ||
.string() | ||
.min(8, "Password should be at least eight characters long"), | ||
}); |