fix: email validation in user post method API (#12743)
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
This commit is contained in:
parent
b236bffca2
commit
0e8ac7e4ed
|
@ -92,7 +92,7 @@ export const schemaUserBaseBodyParams = User.pick({
|
||||||
// Here we can both require or not (adding optional or nullish) and also rewrite validations for any value
|
// Here we can both require or not (adding optional or nullish) and also rewrite validations for any value
|
||||||
// for example making weekStart only accept weekdays as input
|
// for example making weekStart only accept weekdays as input
|
||||||
const schemaUserEditParams = z.object({
|
const schemaUserEditParams = z.object({
|
||||||
email: z.string().email(),
|
email: z.string().email().toLowerCase(),
|
||||||
username: usernameSchema,
|
username: usernameSchema,
|
||||||
weekStart: z.nativeEnum(weekdays).optional(),
|
weekStart: z.nativeEnum(weekdays).optional(),
|
||||||
brandColor: z.string().min(4).max(9).regex(/^#/).optional(),
|
brandColor: z.string().min(4).max(9).regex(/^#/).optional(),
|
||||||
|
@ -114,7 +114,7 @@ const schemaUserEditParams = z.object({
|
||||||
// merging both BaseBodyParams with RequiredParams, and omiting whatever we want at the end.
|
// merging both BaseBodyParams with RequiredParams, and omiting whatever we want at the end.
|
||||||
|
|
||||||
const schemaUserCreateParams = z.object({
|
const schemaUserCreateParams = z.object({
|
||||||
email: z.string().email(),
|
email: z.string().email().toLowerCase(),
|
||||||
username: usernameSchema,
|
username: usernameSchema,
|
||||||
weekStart: z.nativeEnum(weekdays).optional(),
|
weekStart: z.nativeEnum(weekdays).optional(),
|
||||||
brandColor: z.string().min(4).max(9).regex(/^#/).optional(),
|
brandColor: z.string().min(4).max(9).regex(/^#/).optional(),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user