diff --git a/imphnen-dimentorin/src/mentors/infrastructure/http/dto/request.rs b/imphnen-dimentorin/src/mentors/infrastructure/http/dto/request.rs index 122d672..d8030df 100644 --- a/imphnen-dimentorin/src/mentors/infrastructure/http/dto/request.rs +++ b/imphnen-dimentorin/src/mentors/infrastructure/http/dto/request.rs @@ -13,7 +13,7 @@ use zod_rs::prelude::*; pub struct MentorUserRegisterRequestDto { #[zod(email, min_length(1))] pub email: String, - #[zod(min_length(8), regex(pattern = "^[A-Za-z\\d@$!%*?&]{8,}$"))] + #[zod(min_length(8))] pub password: String, #[zod(min_length(2))] pub fullname: String, diff --git a/imphnen-dimentorin/src/mentors/infrastructure/persistence/postgres_mentor_repository.rs b/imphnen-dimentorin/src/mentors/infrastructure/persistence/postgres_mentor_repository.rs index 84246ac..703d9da 100644 --- a/imphnen-dimentorin/src/mentors/infrastructure/persistence/postgres_mentor_repository.rs +++ b/imphnen-dimentorin/src/mentors/infrastructure/persistence/postgres_mentor_repository.rs @@ -105,6 +105,7 @@ impl MentorRepository for PostgresMentorRepository { async fn create(&self, entity: MentorEntity) -> Result { let active_model = MentorActiveModel { + id: ActiveValue::Set(Uuid::new_v4()), user_id: ActiveValue::Set(entity.user_id), industries: ActiveValue::Set(Some( serde_json::to_value(&entity.industries) diff --git a/imphnen-iam/src/auth/infrastructure/http/dto.rs b/imphnen-iam/src/auth/infrastructure/http/dto.rs index b5c15af..666ac5b 100644 --- a/imphnen-iam/src/auth/infrastructure/http/dto.rs +++ b/imphnen-iam/src/auth/infrastructure/http/dto.rs @@ -34,7 +34,7 @@ pub struct AuthLoginResponsetDto { pub struct AuthRegisterRequestDto { #[zod(email, min_length(1))] pub email: String, - #[zod(min_length(8), regex(pattern = "^[A-Za-z\\d@$!%*?&]{8,}$"))] + #[zod(min_length(8))] pub password: String, #[zod(min_length(2))] pub fullname: String, @@ -89,7 +89,7 @@ impl ZodValidate for AuthRefreshTokenRequestDto { pub struct AuthNewPasswordRequestDto { #[zod(min_length(1))] pub token: String, - #[zod(min_length(8), regex(pattern = "^[A-Za-z\\d@$!%*?&]{8,}$"))] + #[zod(min_length(8))] pub password: String, } diff --git a/imphnen-iam/src/users/infrastructure/http/dto.rs b/imphnen-iam/src/users/infrastructure/http/dto.rs index 4df023a..1628ee9 100644 --- a/imphnen-iam/src/users/infrastructure/http/dto.rs +++ b/imphnen-iam/src/users/infrastructure/http/dto.rs @@ -29,7 +29,7 @@ pub struct UsersSetNewPasswordRequestDto { pub struct UsersCreateRequestDto { #[zod(email, min_length(1))] pub email: String, - #[zod(min_length(8), regex(pattern = "^[A-Za-z\\d@$!%*?&]{8,}$"))] + #[zod(min_length(8))] pub password: String, #[zod(min_length(2))] pub fullname: String, diff --git a/imphnen-iam/src/users/infrastructure/persistence/postgres_user_repository.rs b/imphnen-iam/src/users/infrastructure/persistence/postgres_user_repository.rs index 029c55c..95b5c8f 100644 --- a/imphnen-iam/src/users/infrastructure/persistence/postgres_user_repository.rs +++ b/imphnen-iam/src/users/infrastructure/persistence/postgres_user_repository.rs @@ -107,7 +107,9 @@ impl UserRepository for PostgresUserRepository { .ok() .or_else(|| entity.role.id.is_empty().then_some(Uuid::nil())); let active_model = UserActiveModel { - id: ActiveValue::Set(Uuid::new_v4()), + id: ActiveValue::Set( + Uuid::parse_str(&entity.id).unwrap_or_else(|_| Uuid::new_v4()), + ), email: ActiveValue::Set(entity.email.clone()), password_hash: ActiveValue::Set(entity.password), username: ActiveValue::Set(entity.email.clone()),