fix(dimentorin): register mentor flow - zod regex attr, uuid id override in user & mentor repos
- Remove broken zod_rs regex() attribute (always fails, blocks password validation) - user repo create: honor entity.id instead of silently generating new v4 (broke FK mentor.user_id) - mentor repo create: set id explicitly (was NULL not-null violation)
This commit is contained in:
@@ -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,
|
||||
|
||||
+1
@@ -105,6 +105,7 @@ impl MentorRepository for PostgresMentorRepository {
|
||||
|
||||
async fn create(&self, entity: MentorEntity) -> Result<Uuid, AppError> {
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user