From 59e9a0a099d6f762665635256832af555ca8af1c Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Sat, 24 Aug 2024 08:40:17 -0400 Subject: [PATCH] OV-3: - merge conflict solved --- .../bundles/users/enums/user-validation-message.enum.ts | 1 + .../validation-schemas/user-sign-up.validation-schema.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/shared/src/bundles/users/enums/user-validation-message.enum.ts b/shared/src/bundles/users/enums/user-validation-message.enum.ts index ad735094d..95dd74f99 100644 --- a/shared/src/bundles/users/enums/user-validation-message.enum.ts +++ b/shared/src/bundles/users/enums/user-validation-message.enum.ts @@ -9,6 +9,7 @@ const UserValidationMessage = { WRONG_CREDENTIALS: 'Email or password are incorrect', USER_IS_NOT_AVAILABLE: 'User with this email already exists. Log in if it is you', + FULL_NAME_INVALID: 'Name must have at least two words', } as const; export { UserValidationMessage }; diff --git a/shared/src/bundles/users/validation-schemas/user-sign-up.validation-schema.ts b/shared/src/bundles/users/validation-schemas/user-sign-up.validation-schema.ts index 72a886780..92ffb5c3b 100644 --- a/shared/src/bundles/users/validation-schemas/user-sign-up.validation-schema.ts +++ b/shared/src/bundles/users/validation-schemas/user-sign-up.validation-schema.ts @@ -49,6 +49,13 @@ const userSignUp = z .refine((data) => data.password === data.confirmPassword, { message: UserValidationMessage.PASS_DONT_MATCH, path: ['confirmPassword'], - }); + }) + .refine( + (data) => data.name.split(/\s+/).length >= 2, + { + message: UserValidationMessage.FULL_NAME_INVALID, + path: ['name'], + } + ); export { userSignUp };