From c51398a5785f69759dcf84763a0ac5216a4f5d8b Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Mon, 19 Aug 2024 15:01:15 -0400 Subject: [PATCH 01/23] OV-3: + name column to users table, with mods into model and user service @ BE --- backend/src/bundles/users/user.entity.ts | 15 ++++++++ backend/src/bundles/users/user.model.ts | 2 ++ backend/src/bundles/users/user.service.ts | 1 + .../20240814110349_add_users_table.ts | 4 +++ .../enums/user-validation-message.enum.ts | 7 ++-- .../users/enums/user-validation-rule.enum.ts | 3 ++ .../types/user-sign-up-request-dto.type.ts | 2 ++ .../types/user-sign-up-response-dto.type.ts | 1 + .../user-sign-up.validation-schema.ts | 35 +++++++++++++++++-- 9 files changed, 65 insertions(+), 5 deletions(-) diff --git a/backend/src/bundles/users/user.entity.ts b/backend/src/bundles/users/user.entity.ts index 5a6f4a929..9f23d9041 100644 --- a/backend/src/bundles/users/user.entity.ts +++ b/backend/src/bundles/users/user.entity.ts @@ -5,6 +5,8 @@ class UserEntity implements Entity { private 'email': string; + private 'name': string; + private 'passwordHash': string; private 'passwordSalt': string; @@ -12,16 +14,19 @@ class UserEntity implements Entity { private constructor({ id, email, + name, passwordHash, passwordSalt, }: { id: number | null; email: string; + name: string; passwordHash: string; passwordSalt: string; }) { this.id = id; this.email = email; + this.name = name; this.passwordHash = passwordHash; this.passwordSalt = passwordSalt; } @@ -29,17 +34,20 @@ class UserEntity implements Entity { public static initialize({ id, email, + name, passwordHash, passwordSalt, }: { id: number; email: string; + name: string; passwordHash: string; passwordSalt: string; }): UserEntity { return new UserEntity({ id, email, + name, passwordHash, passwordSalt, }); @@ -47,16 +55,19 @@ class UserEntity implements Entity { public static initializeNew({ email, + name, passwordHash, passwordSalt, }: { email: string; + name: string; passwordHash: string; passwordSalt: string; }): UserEntity { return new UserEntity({ id: null, email, + name, passwordHash, passwordSalt, }); @@ -65,20 +76,24 @@ class UserEntity implements Entity { public toObject(): { id: number; email: string; + name: string; } { return { id: this.id as number, email: this.email, + name: this.name, }; } public toNewObject(): { email: string; + name: string; passwordHash: string; passwordSalt: string; } { return { email: this.email, + name: this.name, passwordHash: this.passwordHash, passwordSalt: this.passwordSalt, }; diff --git a/backend/src/bundles/users/user.model.ts b/backend/src/bundles/users/user.model.ts index f46dd5f46..d7f6243d1 100644 --- a/backend/src/bundles/users/user.model.ts +++ b/backend/src/bundles/users/user.model.ts @@ -6,6 +6,8 @@ import { class UserModel extends AbstractModel { public 'email': string; + public 'name': string; + public 'passwordHash': string; public 'passwordSalt': string; diff --git a/backend/src/bundles/users/user.service.ts b/backend/src/bundles/users/user.service.ts index 1616231f0..69a62e303 100644 --- a/backend/src/bundles/users/user.service.ts +++ b/backend/src/bundles/users/user.service.ts @@ -35,6 +35,7 @@ class UserService implements Service { const user = await this.userRepository.create( UserEntity.initializeNew({ email: payload.email, + name: payload.name, passwordSalt: salt, // TODO passwordHash: hash, // TODO }), diff --git a/backend/src/migrations/20240814110349_add_users_table.ts b/backend/src/migrations/20240814110349_add_users_table.ts index cc0d03519..cf321d3d5 100644 --- a/backend/src/migrations/20240814110349_add_users_table.ts +++ b/backend/src/migrations/20240814110349_add_users_table.ts @@ -9,6 +9,7 @@ const ColumnName = { PASSWORD_SALT: 'password_salt', CREATED_AT: 'created_at', UPDATED_AT: 'updated_at', + NAME: 'name', }; async function up(knex: Knex): Promise { @@ -30,6 +31,9 @@ async function up(knex: Knex): Promise { .dateTime(ColumnName.UPDATED_AT) .notNullable() .defaultTo(knex.fn.now()); + table + .string(ColumnName.NAME) + .notNullable(); }); } 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 b28063d96..e8ef590b3 100644 --- a/shared/src/bundles/users/enums/user-validation-message.enum.ts +++ b/shared/src/bundles/users/enums/user-validation-message.enum.ts @@ -1,6 +1,9 @@ const UserValidationMessage = { - EMAIL_REQUIRE: 'Email is required', - EMAIL_WRONG: 'Email is wrong', + FIELD_IS_REQUIRE: 'Please fill out this field', + EMAIL_WRONG: 'Please enter a valid email', + PASS_DONT_MATCH: 'Passwords must be identical', + PASS_WRONG: 'Password must have from 6 to 12 characters', + USER_IS_NOT_AVAILABLE: 'User with this email already exists. Log in if it is you', } as const; export { UserValidationMessage }; diff --git a/shared/src/bundles/users/enums/user-validation-rule.enum.ts b/shared/src/bundles/users/enums/user-validation-rule.enum.ts index 36ca9c2e2..9e4652cd9 100644 --- a/shared/src/bundles/users/enums/user-validation-rule.enum.ts +++ b/shared/src/bundles/users/enums/user-validation-rule.enum.ts @@ -1,5 +1,8 @@ const UserValidationRule = { EMAIL_MINIMUM_LENGTH: 1, + EMAIL_MAXIMUM_LENGTH: 320, + PASSWORD_MINIMUM_LENGTH: 6, + PASSWORD_MAXIMUM_LENGTH: 12, } as const; export { UserValidationRule }; diff --git a/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts b/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts index f056f86a4..f2d1cf7c0 100644 --- a/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts +++ b/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts @@ -1,6 +1,8 @@ type UserSignUpRequestDto = { + name: string; email: string; password: string; + confirmPassword: string; }; export { type UserSignUpRequestDto }; diff --git a/shared/src/bundles/users/types/user-sign-up-response-dto.type.ts b/shared/src/bundles/users/types/user-sign-up-response-dto.type.ts index 624114d52..d1e2df413 100644 --- a/shared/src/bundles/users/types/user-sign-up-response-dto.type.ts +++ b/shared/src/bundles/users/types/user-sign-up-response-dto.type.ts @@ -1,5 +1,6 @@ type UserSignUpResponseDto = { id: number; + name: string; email: string; }; 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 33f7ebf60..0af9d16d3 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 @@ -3,23 +3,52 @@ import { z } from 'zod'; import { UserValidationMessage, UserValidationRule } from '../enums/enums.js'; type UserSignUpRequestValidationDto = { + name: z.ZodString; email: z.ZodString; password: z.ZodString; + confirmPassword: z.ZodString; }; const userSignUp = z .object({ + name: z + .string() + .trim(), email: z .string() .trim() .min(UserValidationRule.EMAIL_MINIMUM_LENGTH, { - message: UserValidationMessage.EMAIL_REQUIRE, + message: UserValidationMessage.EMAIL_WRONG, + }) + .max(UserValidationRule.EMAIL_MAXIMUM_LENGTH, { + message: UserValidationMessage.EMAIL_WRONG, }) .email({ message: UserValidationMessage.EMAIL_WRONG, }), - password: z.string().trim(), + password: z + .string() + .trim() + .min(UserValidationRule.PASSWORD_MINIMUM_LENGTH, { + message: UserValidationMessage.PASS_WRONG, + }) + .max(UserValidationRule.PASSWORD_MAXIMUM_LENGTH, { + message: UserValidationMessage.PASS_WRONG, + }), + confirmPassword: z + .string() + .trim() + .min(UserValidationRule.PASSWORD_MINIMUM_LENGTH, { + message: UserValidationMessage.PASS_WRONG, + }) + .max(UserValidationRule.PASSWORD_MAXIMUM_LENGTH, { + message: UserValidationMessage.PASS_WRONG, + }), }) - .required(); + .required() + .refine((data) => data.password === data.confirmPassword, { + message: UserValidationMessage.PASS_DONT_MATCH, + path: ['confirmPassword'], + }); export { userSignUp }; From 9a3a62bf01a1ffdc46bd6ac776206fddd031aca8 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Mon, 19 Aug 2024 19:54:35 -0400 Subject: [PATCH 02/23] OV-3: * user repository, validations from shared --- backend/src/bundles/auth/auth.controller.ts | 2 ++ backend/src/bundles/users/user.repository.ts | 3 ++- backend/src/bundles/users/user.service.ts | 4 ++-- backend/src/migrations/20240814110349_add_users_table.ts | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/backend/src/bundles/auth/auth.controller.ts b/backend/src/bundles/auth/auth.controller.ts index 7a64ed90f..88c59ce2f 100644 --- a/backend/src/bundles/auth/auth.controller.ts +++ b/backend/src/bundles/auth/auth.controller.ts @@ -53,6 +53,8 @@ class AuthController extends BaseController { * format: email * password: * type: string + * name: + * type: string * responses: * 201: * description: Successful operation diff --git a/backend/src/bundles/users/user.repository.ts b/backend/src/bundles/users/user.repository.ts index be08919a1..bf7bcbe0b 100644 --- a/backend/src/bundles/users/user.repository.ts +++ b/backend/src/bundles/users/user.repository.ts @@ -20,12 +20,13 @@ class UserRepository implements Repository { } public async create(entity: UserEntity): Promise { - const { email, passwordSalt, passwordHash } = entity.toNewObject(); + const { email, name, passwordSalt, passwordHash } = entity.toNewObject(); const item = await this.userModel .query() .insert({ email, + name, passwordSalt, passwordHash, }) diff --git a/backend/src/bundles/users/user.service.ts b/backend/src/bundles/users/user.service.ts index 69a62e303..f098c5d07 100644 --- a/backend/src/bundles/users/user.service.ts +++ b/backend/src/bundles/users/user.service.ts @@ -36,8 +36,8 @@ class UserService implements Service { UserEntity.initializeNew({ email: payload.email, name: payload.name, - passwordSalt: salt, // TODO - passwordHash: hash, // TODO + passwordSalt: salt, + passwordHash: hash, }), ); diff --git a/backend/src/migrations/20240814110349_add_users_table.ts b/backend/src/migrations/20240814110349_add_users_table.ts index cf321d3d5..18ce8f99b 100644 --- a/backend/src/migrations/20240814110349_add_users_table.ts +++ b/backend/src/migrations/20240814110349_add_users_table.ts @@ -20,6 +20,9 @@ async function up(knex: Knex): Promise { .notNullable() .primary() .defaultTo(knex.raw('uuid_generate_v4()')); + table + .string(ColumnName.NAME) + .notNullable(); table.string(ColumnName.EMAIL).unique().notNullable(); table.text(ColumnName.PASSWORD_HASH).notNullable(); table.text(ColumnName.PASSWORD_SALT).notNullable(); @@ -31,9 +34,6 @@ async function up(knex: Knex): Promise { .dateTime(ColumnName.UPDATED_AT) .notNullable() .defaultTo(knex.fn.now()); - table - .string(ColumnName.NAME) - .notNullable(); }); } From b881101f758391b43983621394357bb134521ccc Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Tue, 20 Aug 2024 09:37:45 -0400 Subject: [PATCH 03/23] OV-3: - name from existing migration file, + name to users table in different migration file --- .../migrations/20240814110349_add_users_table.ts | 4 ---- ...0240820093010_add_name_field_to_users_table.ts | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 backend/src/migrations/20240820093010_add_name_field_to_users_table.ts diff --git a/backend/src/migrations/20240814110349_add_users_table.ts b/backend/src/migrations/20240814110349_add_users_table.ts index 18ce8f99b..cc0d03519 100644 --- a/backend/src/migrations/20240814110349_add_users_table.ts +++ b/backend/src/migrations/20240814110349_add_users_table.ts @@ -9,7 +9,6 @@ const ColumnName = { PASSWORD_SALT: 'password_salt', CREATED_AT: 'created_at', UPDATED_AT: 'updated_at', - NAME: 'name', }; async function up(knex: Knex): Promise { @@ -20,9 +19,6 @@ async function up(knex: Knex): Promise { .notNullable() .primary() .defaultTo(knex.raw('uuid_generate_v4()')); - table - .string(ColumnName.NAME) - .notNullable(); table.string(ColumnName.EMAIL).unique().notNullable(); table.text(ColumnName.PASSWORD_HASH).notNullable(); table.text(ColumnName.PASSWORD_SALT).notNullable(); diff --git a/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts b/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts new file mode 100644 index 000000000..8c365ab9e --- /dev/null +++ b/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts @@ -0,0 +1,15 @@ +import { type Knex } from 'knex'; + +const TABLE_NAME = 'users'; + +async function up(knex: Knex): Promise { + await knex.schema.table(TABLE_NAME, (table) => { + table.string('name').notNullable(); + }); +} + +function down(knex: Knex): Promise { + return knex.schema.dropTableIfExists(TABLE_NAME); +} + +export { down, up }; \ No newline at end of file From 09d597dabf456e5afc5d6e7d0ff958dc382fe102 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Tue, 20 Aug 2024 10:10:38 -0400 Subject: [PATCH 04/23] OV-3: - lint and prettier errors --- backend/src/bundles/users/user.repository.ts | 3 ++- backend/src/bundles/users/user.service.ts | 4 ++-- .../20240820093010_add_name_field_to_users_table.ts | 2 +- .../src/bundles/users/enums/user-validation-message.enum.ts | 3 ++- .../validation-schemas/user-sign-up.validation-schema.ts | 4 +--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/src/bundles/users/user.repository.ts b/backend/src/bundles/users/user.repository.ts index bf7bcbe0b..79b4399d8 100644 --- a/backend/src/bundles/users/user.repository.ts +++ b/backend/src/bundles/users/user.repository.ts @@ -20,7 +20,8 @@ class UserRepository implements Repository { } public async create(entity: UserEntity): Promise { - const { email, name, passwordSalt, passwordHash } = entity.toNewObject(); + const { email, name, passwordSalt, passwordHash } = + entity.toNewObject(); const item = await this.userModel .query() diff --git a/backend/src/bundles/users/user.service.ts b/backend/src/bundles/users/user.service.ts index f098c5d07..afc46dbb0 100644 --- a/backend/src/bundles/users/user.service.ts +++ b/backend/src/bundles/users/user.service.ts @@ -36,8 +36,8 @@ class UserService implements Service { UserEntity.initializeNew({ email: payload.email, name: payload.name, - passwordSalt: salt, - passwordHash: hash, + passwordSalt: salt, + passwordHash: hash, }), ); diff --git a/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts b/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts index 8c365ab9e..f99a04bee 100644 --- a/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts +++ b/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts @@ -12,4 +12,4 @@ function down(knex: Knex): Promise { return knex.schema.dropTableIfExists(TABLE_NAME); } -export { down, up }; \ No newline at end of file +export { down, up }; 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 e8ef590b3..fb206862c 100644 --- a/shared/src/bundles/users/enums/user-validation-message.enum.ts +++ b/shared/src/bundles/users/enums/user-validation-message.enum.ts @@ -3,7 +3,8 @@ const UserValidationMessage = { EMAIL_WRONG: 'Please enter a valid email', PASS_DONT_MATCH: 'Passwords must be identical', PASS_WRONG: 'Password must have from 6 to 12 characters', - USER_IS_NOT_AVAILABLE: 'User with this email already exists. Log in if it is you', + USER_IS_NOT_AVAILABLE: + 'User with this email already exists. Log in if it is you', } 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 0af9d16d3..57d4961cb 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 @@ -11,9 +11,7 @@ type UserSignUpRequestValidationDto = { const userSignUp = z .object({ - name: z - .string() - .trim(), + name: z.string().trim(), email: z .string() .trim() From b4dfe2bbacc522cfc4e729e28cd1438fc250c7e2 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Tue, 20 Aug 2024 11:07:31 -0400 Subject: [PATCH 05/23] OV-3: * fix lint errors, * drop field and not table in last migration file --- .../20240820093010_add_name_field_to_users_table.ts | 6 ++++-- .../auth/components/sign-up-form/constants/constants.ts | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts b/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts index f99a04bee..a315f6f86 100644 --- a/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts +++ b/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts @@ -8,8 +8,10 @@ async function up(knex: Knex): Promise { }); } -function down(knex: Knex): Promise { - return knex.schema.dropTableIfExists(TABLE_NAME); +async function down(knex: Knex): Promise { + await knex.schema.table(TABLE_NAME, (table) => { + table.dropColumn('name'); + }); } export { down, up }; diff --git a/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts b/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts index 219f8854a..bee02e2d4 100644 --- a/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts +++ b/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts @@ -1,8 +1,10 @@ import { type UserSignUpRequestDto } from '~/bundles/users/users.js'; const DEFAULT_SIGN_UP_PAYLOAD: UserSignUpRequestDto = { + name: '', email: '', password: '', + confirmPassword: '', }; export { DEFAULT_SIGN_UP_PAYLOAD }; From eca26b82b31415c8c03b05b2d7f7d6f9618cbdeb Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Wed, 21 Aug 2024 15:13:15 -0400 Subject: [PATCH 06/23] OV-3: * user validation messages and user validation schema --- .../enums/user-validation-message.enum.ts | 9 ++++++-- .../users/enums/user-validation-rule.enum.ts | 3 ++- .../user-sign-up.validation-schema.ts | 22 +++++++++++-------- 3 files changed, 22 insertions(+), 12 deletions(-) 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 fb206862c..523398a63 100644 --- a/shared/src/bundles/users/enums/user-validation-message.enum.ts +++ b/shared/src/bundles/users/enums/user-validation-message.enum.ts @@ -1,8 +1,13 @@ const UserValidationMessage = { - FIELD_IS_REQUIRE: 'Please fill out this field', + EMAIL_REQUIRE: 'Email is required', EMAIL_WRONG: 'Please enter a valid email', + FIELD_REQUIRE: 'Please fill out this field', + EMAIL_INVALID: 'Please enter a valid email', + PASSWORD_LENGTH: 'Password must have from 6 to 12 characters', PASS_DONT_MATCH: 'Passwords must be identical', - PASS_WRONG: 'Password must have from 6 to 12 characters', + INVALID_DATA: 'Incorrect email or password. Please try again.', + WRONG_CREDENTIALS: 'Email or password are incorrect', + NAME_MIN_TWO_WORDS: 'Name must contain at least two words', USER_IS_NOT_AVAILABLE: 'User with this email already exists. Log in if it is you', } as const; diff --git a/shared/src/bundles/users/enums/user-validation-rule.enum.ts b/shared/src/bundles/users/enums/user-validation-rule.enum.ts index 9e4652cd9..b4c0b340f 100644 --- a/shared/src/bundles/users/enums/user-validation-rule.enum.ts +++ b/shared/src/bundles/users/enums/user-validation-rule.enum.ts @@ -1,8 +1,9 @@ const UserValidationRule = { - EMAIL_MINIMUM_LENGTH: 1, + EMAIL_MINIMUM_LENGTH: 6, EMAIL_MAXIMUM_LENGTH: 320, PASSWORD_MINIMUM_LENGTH: 6, PASSWORD_MAXIMUM_LENGTH: 12, + NAME_MINIMUM_WORD_LENGTH: 2, } as const; export { UserValidationRule }; 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 57d4961cb..b169f3573 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 @@ -3,7 +3,7 @@ import { z } from 'zod'; import { UserValidationMessage, UserValidationRule } from '../enums/enums.js'; type UserSignUpRequestValidationDto = { - name: z.ZodString; + name: z.ZodEffects; email: z.ZodString; password: z.ZodString; confirmPassword: z.ZodString; @@ -11,9 +11,13 @@ type UserSignUpRequestValidationDto = { const userSignUp = z .object({ - name: z.string().trim(), + name: z.string({ required_error: UserValidationMessage.FIELD_REQUIRE }) + .trim() + .refine((value) => value.split(/\s+/).length >= 2, { + message: UserValidationMessage.NAME_MIN_TWO_WORDS, + }), email: z - .string() + .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) .trim() .min(UserValidationRule.EMAIL_MINIMUM_LENGTH, { message: UserValidationMessage.EMAIL_WRONG, @@ -25,22 +29,22 @@ const userSignUp = z message: UserValidationMessage.EMAIL_WRONG, }), password: z - .string() + .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) .trim() .min(UserValidationRule.PASSWORD_MINIMUM_LENGTH, { - message: UserValidationMessage.PASS_WRONG, + message: UserValidationMessage.PASSWORD_LENGTH, }) .max(UserValidationRule.PASSWORD_MAXIMUM_LENGTH, { - message: UserValidationMessage.PASS_WRONG, + message: UserValidationMessage.PASSWORD_LENGTH, }), confirmPassword: z - .string() + .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) .trim() .min(UserValidationRule.PASSWORD_MINIMUM_LENGTH, { - message: UserValidationMessage.PASS_WRONG, + message: UserValidationMessage.PASSWORD_LENGTH, }) .max(UserValidationRule.PASSWORD_MAXIMUM_LENGTH, { - message: UserValidationMessage.PASS_WRONG, + message: UserValidationMessage.PASSWORD_LENGTH, }), }) .required() From 6fe35036904f1d0519db4a0234a9ab94ddfed9b5 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Wed, 21 Aug 2024 15:41:40 -0400 Subject: [PATCH 07/23] OV-3: * changing name to fullName --- backend/src/bundles/users/user.entity.ts | 28 +++++++++---------- backend/src/bundles/users/user.model.ts | 2 +- backend/src/bundles/users/user.repository.ts | 4 +-- backend/src/bundles/users/user.service.ts | 2 +- ...820093010_add_name_field_to_users_table.ts | 4 +-- .../sign-up-form/constants/constants.ts | 2 +- .../users/enums/user-validation-rule.enum.ts | 2 +- .../types/user-sign-up-request-dto.type.ts | 2 +- .../types/user-sign-up-response-dto.type.ts | 2 +- .../user-sign-up.validation-schema.ts | 6 ++-- 10 files changed, 27 insertions(+), 27 deletions(-) diff --git a/backend/src/bundles/users/user.entity.ts b/backend/src/bundles/users/user.entity.ts index 9f23d9041..0d2f01e9b 100644 --- a/backend/src/bundles/users/user.entity.ts +++ b/backend/src/bundles/users/user.entity.ts @@ -5,7 +5,7 @@ class UserEntity implements Entity { private 'email': string; - private 'name': string; + private 'fullName': string; private 'passwordHash': string; @@ -14,19 +14,19 @@ class UserEntity implements Entity { private constructor({ id, email, - name, + fullName, passwordHash, passwordSalt, }: { id: number | null; email: string; - name: string; + fullName: string; passwordHash: string; passwordSalt: string; }) { this.id = id; this.email = email; - this.name = name; + this.fullName = fullName; this.passwordHash = passwordHash; this.passwordSalt = passwordSalt; } @@ -34,20 +34,20 @@ class UserEntity implements Entity { public static initialize({ id, email, - name, + fullName, passwordHash, passwordSalt, }: { id: number; email: string; - name: string; + fullName: string; passwordHash: string; passwordSalt: string; }): UserEntity { return new UserEntity({ id, email, - name, + fullName, passwordHash, passwordSalt, }); @@ -55,19 +55,19 @@ class UserEntity implements Entity { public static initializeNew({ email, - name, + fullName, passwordHash, passwordSalt, }: { email: string; - name: string; + fullName: string; passwordHash: string; passwordSalt: string; }): UserEntity { return new UserEntity({ id: null, email, - name, + fullName, passwordHash, passwordSalt, }); @@ -76,24 +76,24 @@ class UserEntity implements Entity { public toObject(): { id: number; email: string; - name: string; + fullName: string; } { return { id: this.id as number, email: this.email, - name: this.name, + fullName: this.fullName, }; } public toNewObject(): { email: string; - name: string; + fullName: string; passwordHash: string; passwordSalt: string; } { return { email: this.email, - name: this.name, + fullName: this.fullName, passwordHash: this.passwordHash, passwordSalt: this.passwordSalt, }; diff --git a/backend/src/bundles/users/user.model.ts b/backend/src/bundles/users/user.model.ts index d7f6243d1..32d23b7dd 100644 --- a/backend/src/bundles/users/user.model.ts +++ b/backend/src/bundles/users/user.model.ts @@ -6,7 +6,7 @@ import { class UserModel extends AbstractModel { public 'email': string; - public 'name': string; + public 'fullName': string; public 'passwordHash': string; diff --git a/backend/src/bundles/users/user.repository.ts b/backend/src/bundles/users/user.repository.ts index 79b4399d8..bddec453f 100644 --- a/backend/src/bundles/users/user.repository.ts +++ b/backend/src/bundles/users/user.repository.ts @@ -20,14 +20,14 @@ class UserRepository implements Repository { } public async create(entity: UserEntity): Promise { - const { email, name, passwordSalt, passwordHash } = + const { email, fullName, passwordSalt, passwordHash } = entity.toNewObject(); const item = await this.userModel .query() .insert({ email, - name, + fullName, passwordSalt, passwordHash, }) diff --git a/backend/src/bundles/users/user.service.ts b/backend/src/bundles/users/user.service.ts index afc46dbb0..088c6ca4b 100644 --- a/backend/src/bundles/users/user.service.ts +++ b/backend/src/bundles/users/user.service.ts @@ -35,7 +35,7 @@ class UserService implements Service { const user = await this.userRepository.create( UserEntity.initializeNew({ email: payload.email, - name: payload.name, + fullName: payload.fullName, passwordSalt: salt, passwordHash: hash, }), diff --git a/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts b/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts index a315f6f86..22749b59e 100644 --- a/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts +++ b/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts @@ -4,13 +4,13 @@ const TABLE_NAME = 'users'; async function up(knex: Knex): Promise { await knex.schema.table(TABLE_NAME, (table) => { - table.string('name').notNullable(); + table.string('full_name').notNullable(); }); } async function down(knex: Knex): Promise { await knex.schema.table(TABLE_NAME, (table) => { - table.dropColumn('name'); + table.dropColumn('full_name'); }); } diff --git a/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts b/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts index bee02e2d4..d2168f79b 100644 --- a/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts +++ b/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts @@ -1,7 +1,7 @@ import { type UserSignUpRequestDto } from '~/bundles/users/users.js'; const DEFAULT_SIGN_UP_PAYLOAD: UserSignUpRequestDto = { - name: '', + fullName: '', email: '', password: '', confirmPassword: '', diff --git a/shared/src/bundles/users/enums/user-validation-rule.enum.ts b/shared/src/bundles/users/enums/user-validation-rule.enum.ts index b4c0b340f..514eb3488 100644 --- a/shared/src/bundles/users/enums/user-validation-rule.enum.ts +++ b/shared/src/bundles/users/enums/user-validation-rule.enum.ts @@ -3,7 +3,7 @@ const UserValidationRule = { EMAIL_MAXIMUM_LENGTH: 320, PASSWORD_MINIMUM_LENGTH: 6, PASSWORD_MAXIMUM_LENGTH: 12, - NAME_MINIMUM_WORD_LENGTH: 2, + FULL_NAME_MINIMUM_WORD_LENGTH: 2, } as const; export { UserValidationRule }; diff --git a/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts b/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts index f2d1cf7c0..3b611d2b6 100644 --- a/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts +++ b/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts @@ -1,5 +1,5 @@ type UserSignUpRequestDto = { - name: string; + fullName: string; email: string; password: string; confirmPassword: string; diff --git a/shared/src/bundles/users/types/user-sign-up-response-dto.type.ts b/shared/src/bundles/users/types/user-sign-up-response-dto.type.ts index d1e2df413..ee15fdaf8 100644 --- a/shared/src/bundles/users/types/user-sign-up-response-dto.type.ts +++ b/shared/src/bundles/users/types/user-sign-up-response-dto.type.ts @@ -1,6 +1,6 @@ type UserSignUpResponseDto = { id: number; - name: string; + fullName: string; email: string; }; 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 b169f3573..d069e611f 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 @@ -3,7 +3,7 @@ import { z } from 'zod'; import { UserValidationMessage, UserValidationRule } from '../enums/enums.js'; type UserSignUpRequestValidationDto = { - name: z.ZodEffects; + fullName: z.ZodEffects; email: z.ZodString; password: z.ZodString; confirmPassword: z.ZodString; @@ -11,9 +11,9 @@ type UserSignUpRequestValidationDto = { const userSignUp = z .object({ - name: z.string({ required_error: UserValidationMessage.FIELD_REQUIRE }) + fullName: z.string({ required_error: UserValidationMessage.FIELD_REQUIRE }) .trim() - .refine((value) => value.split(/\s+/).length >= 2, { + .refine((value) => value.split(/\s+/).length >= UserValidationRule.FULL_NAME_MINIMUM_WORD_LENGTH, { message: UserValidationMessage.NAME_MIN_TWO_WORDS, }), email: z From 53c0a6ad88250306376134ef3021f3950ef16c6e Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Wed, 21 Aug 2024 15:46:12 -0400 Subject: [PATCH 08/23] OV-3: * applying lint format --- .../user-sign-up.validation-schema.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 d069e611f..423f288c7 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 @@ -11,11 +11,17 @@ type UserSignUpRequestValidationDto = { const userSignUp = z .object({ - fullName: z.string({ required_error: UserValidationMessage.FIELD_REQUIRE }) + fullName: z + .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) .trim() - .refine((value) => value.split(/\s+/).length >= UserValidationRule.FULL_NAME_MINIMUM_WORD_LENGTH, { - message: UserValidationMessage.NAME_MIN_TWO_WORDS, - }), + .refine( + (value) => + value.split(/\s+/).length >= + UserValidationRule.FULL_NAME_MINIMUM_WORD_LENGTH, + { + message: UserValidationMessage.NAME_MIN_TWO_WORDS, + }, + ), email: z .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) .trim() From 56d664e72084d26fdddc9570eeab4b519185eea9 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Thu, 22 Aug 2024 08:41:59 -0400 Subject: [PATCH 09/23] OV-3: * validation rules --- shared/src/bundles/users/enums/user-validation-rule.enum.ts | 1 - .../users/validation-schemas/user-sign-up.validation-schema.ts | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/shared/src/bundles/users/enums/user-validation-rule.enum.ts b/shared/src/bundles/users/enums/user-validation-rule.enum.ts index 514eb3488..eb7d606aa 100644 --- a/shared/src/bundles/users/enums/user-validation-rule.enum.ts +++ b/shared/src/bundles/users/enums/user-validation-rule.enum.ts @@ -3,7 +3,6 @@ const UserValidationRule = { EMAIL_MAXIMUM_LENGTH: 320, PASSWORD_MINIMUM_LENGTH: 6, PASSWORD_MAXIMUM_LENGTH: 12, - FULL_NAME_MINIMUM_WORD_LENGTH: 2, } as const; export { UserValidationRule }; 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 423f288c7..9c7de663e 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 @@ -16,8 +16,7 @@ const userSignUp = z .trim() .refine( (value) => - value.split(/\s+/).length >= - UserValidationRule.FULL_NAME_MINIMUM_WORD_LENGTH, + value.split(/\s+/).length >= 2, { message: UserValidationMessage.NAME_MIN_TWO_WORDS, }, From 25d2f9ea0f3c953b63436e542dc92b52a0700323 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Thu, 22 Aug 2024 08:45:34 -0400 Subject: [PATCH 10/23] OV-3: * validation messages --- .../src/bundles/users/enums/user-validation-message.enum.ts | 4 ---- .../validation-schemas/user-sign-up.validation-schema.ts | 6 +----- 2 files changed, 1 insertion(+), 9 deletions(-) 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 523398a63..9d84754b2 100644 --- a/shared/src/bundles/users/enums/user-validation-message.enum.ts +++ b/shared/src/bundles/users/enums/user-validation-message.enum.ts @@ -1,15 +1,11 @@ const UserValidationMessage = { - EMAIL_REQUIRE: 'Email is required', EMAIL_WRONG: 'Please enter a valid email', FIELD_REQUIRE: 'Please fill out this field', EMAIL_INVALID: 'Please enter a valid email', PASSWORD_LENGTH: 'Password must have from 6 to 12 characters', - PASS_DONT_MATCH: 'Passwords must be identical', INVALID_DATA: 'Incorrect email or password. Please try again.', WRONG_CREDENTIALS: 'Email or password are incorrect', NAME_MIN_TWO_WORDS: 'Name must contain at least two words', - USER_IS_NOT_AVAILABLE: - 'User with this email already exists. Log in if it is you', } 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 9c7de663e..9771d8b18 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 @@ -52,10 +52,6 @@ const userSignUp = z message: UserValidationMessage.PASSWORD_LENGTH, }), }) - .required() - .refine((data) => data.password === data.confirmPassword, { - message: UserValidationMessage.PASS_DONT_MATCH, - path: ['confirmPassword'], - }); + .required(); export { userSignUp }; From 58895f3e281f790d6aeb122b8c039065cf40e6a3 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Thu, 22 Aug 2024 08:49:22 -0400 Subject: [PATCH 11/23] OV-3: * validation messages --- .../src/bundles/users/enums/user-validation-message.enum.ts | 4 ++-- .../validation-schemas/user-sign-up.validation-schema.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 9d84754b2..3aa42e486 100644 --- a/shared/src/bundles/users/enums/user-validation-message.enum.ts +++ b/shared/src/bundles/users/enums/user-validation-message.enum.ts @@ -1,11 +1,11 @@ const UserValidationMessage = { - EMAIL_WRONG: 'Please enter a valid email', + EMAIL_REQUIRE: 'Email is required', + EMAIL_WRONG: 'Email is wrong', FIELD_REQUIRE: 'Please fill out this field', EMAIL_INVALID: 'Please enter a valid email', PASSWORD_LENGTH: 'Password must have from 6 to 12 characters', INVALID_DATA: 'Incorrect email or password. Please try again.', WRONG_CREDENTIALS: 'Email or password are incorrect', - NAME_MIN_TWO_WORDS: 'Name must contain 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 9771d8b18..7526c681c 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 @@ -18,7 +18,7 @@ const userSignUp = z (value) => value.split(/\s+/).length >= 2, { - message: UserValidationMessage.NAME_MIN_TWO_WORDS, + message: 'Full name should have a minimum of two words.', }, ), email: z From 375b4f01dd1c92baa2061120106828a47fc3e7e7 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Thu, 22 Aug 2024 08:52:36 -0400 Subject: [PATCH 12/23] OV-3: * lint format --- .../user-sign-up.validation-schema.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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 7526c681c..7811599b2 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 @@ -14,13 +14,9 @@ const userSignUp = z fullName: z .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) .trim() - .refine( - (value) => - value.split(/\s+/).length >= 2, - { - message: 'Full name should have a minimum of two words.', - }, - ), + .refine((value) => value.split(/\s+/).length >= 2, { + message: 'Full name should have a minimum of two words.', + }), email: z .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) .trim() From de12058aa41cd77a17f05d8edd196d5fc8a8b7c5 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Thu, 22 Aug 2024 13:30:13 -0400 Subject: [PATCH 13/23] OV-3: * fullName in auth controller --- backend/src/bundles/auth/auth.controller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/bundles/auth/auth.controller.ts b/backend/src/bundles/auth/auth.controller.ts index 88c59ce2f..e47efd6cc 100644 --- a/backend/src/bundles/auth/auth.controller.ts +++ b/backend/src/bundles/auth/auth.controller.ts @@ -53,7 +53,7 @@ class AuthController extends BaseController { * format: email * password: * type: string - * name: + * fullName: * type: string * responses: * 201: From a628e34204aec63ede19e0d6960277b0a177a142 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Fri, 23 Aug 2024 17:41:46 -0400 Subject: [PATCH 14/23] OV-3: * solve merge conficts --- .../sign-up-form/constants/constants.ts | 2 +- .../enums/user-validation-message.enum.ts | 3 +++ .../types/user-sign-up-request-dto.type.ts | 2 +- .../user-sign-up.validation-schema.ts | 21 ++++++++++--------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts b/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts index d2168f79b..bee02e2d4 100644 --- a/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts +++ b/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts @@ -1,7 +1,7 @@ import { type UserSignUpRequestDto } from '~/bundles/users/users.js'; const DEFAULT_SIGN_UP_PAYLOAD: UserSignUpRequestDto = { - fullName: '', + name: '', email: '', password: '', confirmPassword: '', 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 3aa42e486..ad735094d 100644 --- a/shared/src/bundles/users/enums/user-validation-message.enum.ts +++ b/shared/src/bundles/users/enums/user-validation-message.enum.ts @@ -4,8 +4,11 @@ const UserValidationMessage = { FIELD_REQUIRE: 'Please fill out this field', EMAIL_INVALID: 'Please enter a valid email', PASSWORD_LENGTH: 'Password must have from 6 to 12 characters', + PASS_DONT_MATCH: 'Passwords must be identical', INVALID_DATA: 'Incorrect email or password. Please try again.', WRONG_CREDENTIALS: 'Email or password are incorrect', + USER_IS_NOT_AVAILABLE: + 'User with this email already exists. Log in if it is you', } as const; export { UserValidationMessage }; diff --git a/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts b/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts index 3b611d2b6..f2d1cf7c0 100644 --- a/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts +++ b/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts @@ -1,5 +1,5 @@ type UserSignUpRequestDto = { - fullName: string; + name: string; email: string; password: string; confirmPassword: string; 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 7811599b2..72a886780 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 @@ -3,7 +3,7 @@ import { z } from 'zod'; import { UserValidationMessage, UserValidationRule } from '../enums/enums.js'; type UserSignUpRequestValidationDto = { - fullName: z.ZodEffects; + name: z.ZodString; email: z.ZodString; password: z.ZodString; confirmPassword: z.ZodString; @@ -11,23 +11,20 @@ type UserSignUpRequestValidationDto = { const userSignUp = z .object({ - fullName: z + name: z .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) - .trim() - .refine((value) => value.split(/\s+/).length >= 2, { - message: 'Full name should have a minimum of two words.', - }), + .trim(), email: z .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) .trim() .min(UserValidationRule.EMAIL_MINIMUM_LENGTH, { - message: UserValidationMessage.EMAIL_WRONG, + message: UserValidationMessage.EMAIL_INVALID, }) .max(UserValidationRule.EMAIL_MAXIMUM_LENGTH, { - message: UserValidationMessage.EMAIL_WRONG, + message: UserValidationMessage.EMAIL_INVALID, }) .email({ - message: UserValidationMessage.EMAIL_WRONG, + message: UserValidationMessage.EMAIL_INVALID, }), password: z .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) @@ -48,6 +45,10 @@ const userSignUp = z message: UserValidationMessage.PASSWORD_LENGTH, }), }) - .required(); + .required() + .refine((data) => data.password === data.confirmPassword, { + message: UserValidationMessage.PASS_DONT_MATCH, + path: ['confirmPassword'], + }); export { userSignUp }; From 82d819d709e1f574d3e333732dbbcadb2de6ec0f Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Fri, 23 Aug 2024 17:50:52 -0400 Subject: [PATCH 15/23] OV-3: * validations --- .../bundles/users/enums/user-validation-message.enum.ts | 1 + .../bundles/users/types/user-sign-up-request-dto.type.ts | 2 +- .../validation-schemas/user-sign-up.validation-schema.ts | 9 ++++++--- 3 files changed, 8 insertions(+), 4 deletions(-) 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/types/user-sign-up-request-dto.type.ts b/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts index f2d1cf7c0..3b611d2b6 100644 --- a/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts +++ b/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts @@ -1,5 +1,5 @@ type UserSignUpRequestDto = { - name: string; + fullName: string; email: string; password: string; confirmPassword: string; 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..1415c4333 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 @@ -3,7 +3,7 @@ import { z } from 'zod'; import { UserValidationMessage, UserValidationRule } from '../enums/enums.js'; type UserSignUpRequestValidationDto = { - name: z.ZodString; + fullName: z.ZodEffects; email: z.ZodString; password: z.ZodString; confirmPassword: z.ZodString; @@ -11,9 +11,12 @@ type UserSignUpRequestValidationDto = { const userSignUp = z .object({ - name: z + fullName: z .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) - .trim(), + .trim() + .refine((value) => value.split(/\s+/).length >= 2, { + message: UserValidationMessage.FULL_NAME_INVALID, + }), email: z .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) .trim() From bef91bbaab5712d7d9a98c190918c2448a535a48 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Fri, 23 Aug 2024 19:57:54 -0400 Subject: [PATCH 16/23] OV-3: * merge conflicts --- backend/src/bundles/auth/auth.controller.ts | 2 +- backend/src/bundles/users/user.entity.ts | 28 +++++++++---------- backend/src/bundles/users/user.model.ts | 2 +- backend/src/bundles/users/user.repository.ts | 4 +-- backend/src/bundles/users/user.service.ts | 2 +- .../types/user-sign-up-request-dto.type.ts | 2 +- .../types/user-sign-up-response-dto.type.ts | 2 +- .../user-sign-up.validation-schema.ts | 18 +++++++----- 8 files changed, 32 insertions(+), 28 deletions(-) diff --git a/backend/src/bundles/auth/auth.controller.ts b/backend/src/bundles/auth/auth.controller.ts index e47efd6cc..88c59ce2f 100644 --- a/backend/src/bundles/auth/auth.controller.ts +++ b/backend/src/bundles/auth/auth.controller.ts @@ -53,7 +53,7 @@ class AuthController extends BaseController { * format: email * password: * type: string - * fullName: + * name: * type: string * responses: * 201: diff --git a/backend/src/bundles/users/user.entity.ts b/backend/src/bundles/users/user.entity.ts index 0d2f01e9b..9f23d9041 100644 --- a/backend/src/bundles/users/user.entity.ts +++ b/backend/src/bundles/users/user.entity.ts @@ -5,7 +5,7 @@ class UserEntity implements Entity { private 'email': string; - private 'fullName': string; + private 'name': string; private 'passwordHash': string; @@ -14,19 +14,19 @@ class UserEntity implements Entity { private constructor({ id, email, - fullName, + name, passwordHash, passwordSalt, }: { id: number | null; email: string; - fullName: string; + name: string; passwordHash: string; passwordSalt: string; }) { this.id = id; this.email = email; - this.fullName = fullName; + this.name = name; this.passwordHash = passwordHash; this.passwordSalt = passwordSalt; } @@ -34,20 +34,20 @@ class UserEntity implements Entity { public static initialize({ id, email, - fullName, + name, passwordHash, passwordSalt, }: { id: number; email: string; - fullName: string; + name: string; passwordHash: string; passwordSalt: string; }): UserEntity { return new UserEntity({ id, email, - fullName, + name, passwordHash, passwordSalt, }); @@ -55,19 +55,19 @@ class UserEntity implements Entity { public static initializeNew({ email, - fullName, + name, passwordHash, passwordSalt, }: { email: string; - fullName: string; + name: string; passwordHash: string; passwordSalt: string; }): UserEntity { return new UserEntity({ id: null, email, - fullName, + name, passwordHash, passwordSalt, }); @@ -76,24 +76,24 @@ class UserEntity implements Entity { public toObject(): { id: number; email: string; - fullName: string; + name: string; } { return { id: this.id as number, email: this.email, - fullName: this.fullName, + name: this.name, }; } public toNewObject(): { email: string; - fullName: string; + name: string; passwordHash: string; passwordSalt: string; } { return { email: this.email, - fullName: this.fullName, + name: this.name, passwordHash: this.passwordHash, passwordSalt: this.passwordSalt, }; diff --git a/backend/src/bundles/users/user.model.ts b/backend/src/bundles/users/user.model.ts index 32d23b7dd..d7f6243d1 100644 --- a/backend/src/bundles/users/user.model.ts +++ b/backend/src/bundles/users/user.model.ts @@ -6,7 +6,7 @@ import { class UserModel extends AbstractModel { public 'email': string; - public 'fullName': string; + public 'name': string; public 'passwordHash': string; diff --git a/backend/src/bundles/users/user.repository.ts b/backend/src/bundles/users/user.repository.ts index bddec453f..79b4399d8 100644 --- a/backend/src/bundles/users/user.repository.ts +++ b/backend/src/bundles/users/user.repository.ts @@ -20,14 +20,14 @@ class UserRepository implements Repository { } public async create(entity: UserEntity): Promise { - const { email, fullName, passwordSalt, passwordHash } = + const { email, name, passwordSalt, passwordHash } = entity.toNewObject(); const item = await this.userModel .query() .insert({ email, - fullName, + name, passwordSalt, passwordHash, }) diff --git a/backend/src/bundles/users/user.service.ts b/backend/src/bundles/users/user.service.ts index 088c6ca4b..afc46dbb0 100644 --- a/backend/src/bundles/users/user.service.ts +++ b/backend/src/bundles/users/user.service.ts @@ -35,7 +35,7 @@ class UserService implements Service { const user = await this.userRepository.create( UserEntity.initializeNew({ email: payload.email, - fullName: payload.fullName, + name: payload.name, passwordSalt: salt, passwordHash: hash, }), diff --git a/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts b/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts index 3b611d2b6..f2d1cf7c0 100644 --- a/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts +++ b/shared/src/bundles/users/types/user-sign-up-request-dto.type.ts @@ -1,5 +1,5 @@ type UserSignUpRequestDto = { - fullName: string; + name: string; email: string; password: string; confirmPassword: string; diff --git a/shared/src/bundles/users/types/user-sign-up-response-dto.type.ts b/shared/src/bundles/users/types/user-sign-up-response-dto.type.ts index ee15fdaf8..d1e2df413 100644 --- a/shared/src/bundles/users/types/user-sign-up-response-dto.type.ts +++ b/shared/src/bundles/users/types/user-sign-up-response-dto.type.ts @@ -1,6 +1,6 @@ type UserSignUpResponseDto = { id: number; - fullName: string; + name: string; email: string; }; 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 1415c4333..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 @@ -3,7 +3,7 @@ import { z } from 'zod'; import { UserValidationMessage, UserValidationRule } from '../enums/enums.js'; type UserSignUpRequestValidationDto = { - fullName: z.ZodEffects; + name: z.ZodString; email: z.ZodString; password: z.ZodString; confirmPassword: z.ZodString; @@ -11,12 +11,9 @@ type UserSignUpRequestValidationDto = { const userSignUp = z .object({ - fullName: z + name: z .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) - .trim() - .refine((value) => value.split(/\s+/).length >= 2, { - message: UserValidationMessage.FULL_NAME_INVALID, - }), + .trim(), email: z .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) .trim() @@ -52,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 }; From 3a962ad9c667731254afdac8b88726a608e25388 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Sat, 24 Aug 2024 08:26:06 -0400 Subject: [PATCH 17/23] OV-3: * solve merge conficts --- .../20240820093010_add_name_field_to_users_table.ts | 4 ++-- .../bundles/users/enums/user-validation-message.enum.ts | 1 - .../validation-schemas/user-sign-up.validation-schema.ts | 9 +-------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts b/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts index 22749b59e..a315f6f86 100644 --- a/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts +++ b/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts @@ -4,13 +4,13 @@ const TABLE_NAME = 'users'; async function up(knex: Knex): Promise { await knex.schema.table(TABLE_NAME, (table) => { - table.string('full_name').notNullable(); + table.string('name').notNullable(); }); } async function down(knex: Knex): Promise { await knex.schema.table(TABLE_NAME, (table) => { - table.dropColumn('full_name'); + table.dropColumn('name'); }); } 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 95dd74f99..ad735094d 100644 --- a/shared/src/bundles/users/enums/user-validation-message.enum.ts +++ b/shared/src/bundles/users/enums/user-validation-message.enum.ts @@ -9,7 +9,6 @@ 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 92ffb5c3b..72a886780 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,13 +49,6 @@ 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 }; From 59e9a0a099d6f762665635256832af555ca8af1c Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Sat, 24 Aug 2024 08:40:17 -0400 Subject: [PATCH 18/23] 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 }; From 0bdf6b50a9807b74040679cda3f8723169ab4159 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Sat, 24 Aug 2024 08:45:26 -0400 Subject: [PATCH 19/23] OV-3: * lint and prettier --- .../user-sign-up.validation-schema.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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 92ffb5c3b..ad8a1f586 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 @@ -50,12 +50,9 @@ const userSignUp = z message: UserValidationMessage.PASS_DONT_MATCH, path: ['confirmPassword'], }) - .refine( - (data) => data.name.split(/\s+/).length >= 2, - { - message: UserValidationMessage.FULL_NAME_INVALID, - path: ['name'], - } - ); + .refine((data) => data.name.split(/\s+/).length >= 2, { + message: UserValidationMessage.FULL_NAME_INVALID, + path: ['name'], + }); export { userSignUp }; From afaea065592f284ef0be3c8ca6e684b7a9adb489 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Tue, 27 Aug 2024 15:26:17 -0400 Subject: [PATCH 20/23] OV-3: * name to fullName --- backend/src/bundles/auth/auth.controller.ts | 9 +++++- backend/src/bundles/auth/auth.service.ts | 10 ++++++- backend/src/bundles/users/user.entity.ts | 28 +++++++++---------- backend/src/bundles/users/user.model.ts | 2 +- backend/src/bundles/users/user.repository.ts | 4 +-- backend/src/bundles/users/user.service.ts | 2 +- ...820093010_add_name_field_to_users_table.ts | 4 +-- .../sign-up-form/constants/constants.ts | 2 +- .../components/sign-up-form/sign-up-form.tsx | 2 +- .../enums/user-validation-message.enum.ts | 1 + .../types/user-sign-up-request-dto.type.ts | 2 +- .../types/user-sign-up-response-dto.type.ts | 2 +- .../user-sign-up.validation-schema.ts | 12 ++++---- 13 files changed, 48 insertions(+), 32 deletions(-) diff --git a/backend/src/bundles/auth/auth.controller.ts b/backend/src/bundles/auth/auth.controller.ts index aa3309522..324870b15 100644 --- a/backend/src/bundles/auth/auth.controller.ts +++ b/backend/src/bundles/auth/auth.controller.ts @@ -120,7 +120,7 @@ class AuthController extends BaseController { * format: email * password: * type: string - * name: + * fullName: * type: string * responses: * 201: @@ -133,6 +133,13 @@ class AuthController extends BaseController { * message: * type: object * $ref: '#/components/schemas/User' + * 400: + * description: Failed operation + * content: + * application/json: + * schema: + * type: object + * $ref: '#/components/schemas/Error' */ private async signUp( diff --git a/backend/src/bundles/auth/auth.service.ts b/backend/src/bundles/auth/auth.service.ts index fabf0d934..27c90ab19 100644 --- a/backend/src/bundles/auth/auth.service.ts +++ b/backend/src/bundles/auth/auth.service.ts @@ -49,9 +49,17 @@ class AuthService { return user.toObject(); } - public signUp( + public async signUp( userRequestDto: UserSignUpRequestDto, ): Promise { + const { email } = userRequestDto; + const emailExists = await this.userService.findByEmail(email); + if(emailExists){ + throw new HttpError({ + message: UserValidationMessage.EMAIL_ALREADY_EXISTS, + status: HttpCode.BAD_REQUEST, + }); + } return this.userService.create(userRequestDto); } } diff --git a/backend/src/bundles/users/user.entity.ts b/backend/src/bundles/users/user.entity.ts index 9f23d9041..0d2f01e9b 100644 --- a/backend/src/bundles/users/user.entity.ts +++ b/backend/src/bundles/users/user.entity.ts @@ -5,7 +5,7 @@ class UserEntity implements Entity { private 'email': string; - private 'name': string; + private 'fullName': string; private 'passwordHash': string; @@ -14,19 +14,19 @@ class UserEntity implements Entity { private constructor({ id, email, - name, + fullName, passwordHash, passwordSalt, }: { id: number | null; email: string; - name: string; + fullName: string; passwordHash: string; passwordSalt: string; }) { this.id = id; this.email = email; - this.name = name; + this.fullName = fullName; this.passwordHash = passwordHash; this.passwordSalt = passwordSalt; } @@ -34,20 +34,20 @@ class UserEntity implements Entity { public static initialize({ id, email, - name, + fullName, passwordHash, passwordSalt, }: { id: number; email: string; - name: string; + fullName: string; passwordHash: string; passwordSalt: string; }): UserEntity { return new UserEntity({ id, email, - name, + fullName, passwordHash, passwordSalt, }); @@ -55,19 +55,19 @@ class UserEntity implements Entity { public static initializeNew({ email, - name, + fullName, passwordHash, passwordSalt, }: { email: string; - name: string; + fullName: string; passwordHash: string; passwordSalt: string; }): UserEntity { return new UserEntity({ id: null, email, - name, + fullName, passwordHash, passwordSalt, }); @@ -76,24 +76,24 @@ class UserEntity implements Entity { public toObject(): { id: number; email: string; - name: string; + fullName: string; } { return { id: this.id as number, email: this.email, - name: this.name, + fullName: this.fullName, }; } public toNewObject(): { email: string; - name: string; + fullName: string; passwordHash: string; passwordSalt: string; } { return { email: this.email, - name: this.name, + fullName: this.fullName, passwordHash: this.passwordHash, passwordSalt: this.passwordSalt, }; diff --git a/backend/src/bundles/users/user.model.ts b/backend/src/bundles/users/user.model.ts index d7f6243d1..32d23b7dd 100644 --- a/backend/src/bundles/users/user.model.ts +++ b/backend/src/bundles/users/user.model.ts @@ -6,7 +6,7 @@ import { class UserModel extends AbstractModel { public 'email': string; - public 'name': string; + public 'fullName': string; public 'passwordHash': string; diff --git a/backend/src/bundles/users/user.repository.ts b/backend/src/bundles/users/user.repository.ts index 359af6884..af68505e8 100644 --- a/backend/src/bundles/users/user.repository.ts +++ b/backend/src/bundles/users/user.repository.ts @@ -26,14 +26,14 @@ class UserRepository implements Repository { } public async create(entity: UserEntity): Promise { - const { email, name, passwordSalt, passwordHash } = + const { email, fullName, passwordSalt, passwordHash } = entity.toNewObject(); const item = await this.userModel .query() .insert({ email, - name, + fullName, passwordSalt, passwordHash, }) diff --git a/backend/src/bundles/users/user.service.ts b/backend/src/bundles/users/user.service.ts index a101fcacf..b55b0c301 100644 --- a/backend/src/bundles/users/user.service.ts +++ b/backend/src/bundles/users/user.service.ts @@ -39,7 +39,7 @@ class UserService implements Service { const user = await this.userRepository.create( UserEntity.initializeNew({ email: payload.email, - name: payload.name, + fullName: payload.fullName, passwordSalt: salt, passwordHash: hash, }), diff --git a/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts b/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts index a315f6f86..22749b59e 100644 --- a/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts +++ b/backend/src/migrations/20240820093010_add_name_field_to_users_table.ts @@ -4,13 +4,13 @@ const TABLE_NAME = 'users'; async function up(knex: Knex): Promise { await knex.schema.table(TABLE_NAME, (table) => { - table.string('name').notNullable(); + table.string('full_name').notNullable(); }); } async function down(knex: Knex): Promise { await knex.schema.table(TABLE_NAME, (table) => { - table.dropColumn('name'); + table.dropColumn('full_name'); }); } diff --git a/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts b/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts index bee02e2d4..d2168f79b 100644 --- a/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts +++ b/frontend/src/bundles/auth/components/sign-up-form/constants/constants.ts @@ -1,7 +1,7 @@ import { type UserSignUpRequestDto } from '~/bundles/users/users.js'; const DEFAULT_SIGN_UP_PAYLOAD: UserSignUpRequestDto = { - name: '', + fullName: '', email: '', password: '', confirmPassword: '', diff --git a/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx b/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx index d0a791e17..aead68935 100644 --- a/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx +++ b/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx @@ -63,7 +63,7 @@ const SignUpForm: React.FC = ({ onSubmit }) => { type="text" label="Full Name" placeholder="Name" - name="name" + name="fullName" /> ({ - name: z + fullName: z .string({ required_error: UserValidationMessage.FIELD_REQUIRE }) .trim(), email: z @@ -46,13 +46,13 @@ const userSignUp = z }), }) .required() + .refine((data) => data.fullName.split(/\s+/).length >= 2, { + message: UserValidationMessage.FULL_NAME_INVALID, + path: ['name'], + }) .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 }; From 2ab3912b91f628a01e03fdaf9059a3f92d7d4261 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Tue, 27 Aug 2024 15:28:36 -0400 Subject: [PATCH 21/23] OV-3: * name to fullName --- backend/src/bundles/auth/auth.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/bundles/auth/auth.service.ts b/backend/src/bundles/auth/auth.service.ts index 27c90ab19..1372f1a8d 100644 --- a/backend/src/bundles/auth/auth.service.ts +++ b/backend/src/bundles/auth/auth.service.ts @@ -54,7 +54,7 @@ class AuthService { ): Promise { const { email } = userRequestDto; const emailExists = await this.userService.findByEmail(email); - if(emailExists){ + if (emailExists) { throw new HttpError({ message: UserValidationMessage.EMAIL_ALREADY_EXISTS, status: HttpCode.BAD_REQUEST, From d3ac3eb124bbd663965c881fe0b11a7feff648a3 Mon Sep 17 00:00:00 2001 From: JuanSaavedra Date: Tue, 27 Aug 2024 15:36:50 -0400 Subject: [PATCH 22/23] OV-3: * name to fullName --- .../src/bundles/auth/components/sign-up-form/sign-up-form.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx b/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx index aead68935..d0a791e17 100644 --- a/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx +++ b/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx @@ -63,7 +63,7 @@ const SignUpForm: React.FC = ({ onSubmit }) => { type="text" label="Full Name" placeholder="Name" - name="fullName" + name="name" /> Date: Tue, 27 Aug 2024 15:42:03 -0400 Subject: [PATCH 23/23] OV-3: * name to fullName, solve merge conflicts --- .../src/bundles/auth/components/sign-up-form/sign-up-form.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx b/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx index 2d58981e3..d1d7b74ad 100644 --- a/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx +++ b/frontend/src/bundles/auth/components/sign-up-form/sign-up-form.tsx @@ -63,7 +63,7 @@ const SignUpForm: React.FC = ({ onSubmit }) => { type="text" label="Full Name" placeholder="Name" - name="name" + name="fullName" required />