Refactor mentor and user schemas to centralize personal data management

- Updated `seed_mentor_user.rs` to include additional fields in the `app_users` creation and removed redundant fields from `app_mentors`.
- Modified `seed_users.rs` to initialize new user fields including legal name, domicile, and professional links.
- Adjusted `mentors_dto.rs` to remove personal data fields from `MentorDetailWithUserDto` and `MentorDetailResponseDto`, now sourced from `UsersSchema`.
- Updated `mentors_repository.rs` to search for user data through `user_id` instead of mentor fields.
- Refined `mentors_schema.rs` to remove personal data fields, now managed in `UsersSchema`.
- Enhanced `mentors_service.rs` to populate mentor responses with user data from `UsersSchema`.
- Removed identity document URL and related fields from various DTOs and schemas across the codebase.
- Updated tests to reflect the removal of identity document URL and ensure compatibility with the new schema structure.
This commit is contained in:
MythEclipse
2025-08-12 18:43:30 +07:00
parent 34b6cdabfb
commit 1b9251b2dd
12 changed files with 166 additions and 637 deletions
-7
View File
@@ -82,7 +82,6 @@ pub struct UsersUpdateRequestDto {
pub birthdate: Option<String>,
pub domicile: Option<String>,
#[validate(url(message = "Invalid identity document URL"))]
pub identity_document_url: Option<String>,
#[validate(length(min = 50, message = "Bio must be at least 50 characters"))]
pub bio: Option<String>,
pub last_education: Option<String>,
@@ -113,7 +112,6 @@ pub struct UsersDetailItemDto {
pub gender: Option<String>,
pub birthdate: Option<String>,
pub domicile: Option<String>,
pub identity_document_url: Option<String>,
pub bio: Option<String>,
pub last_education: Option<String>,
pub linkedin_url: Option<String>,
@@ -139,7 +137,6 @@ impl UsersDetailItemDto {
gender: dto.gender.clone(),
birthdate: dto.birthdate.clone(),
domicile: dto.domicile.clone(),
identity_document_url: dto.identity_document_url.clone(),
bio: dto.bio.clone(),
last_education: dto.last_education.clone(),
linkedin_url: dto.linkedin_url.clone(),
@@ -165,7 +162,6 @@ impl UsersDetailItemDto {
gender: schema.gender.clone(),
birthdate: schema.birthdate.clone(),
domicile: schema.domicile.clone(),
identity_document_url: schema.identity_document_url.clone(),
bio: schema.bio.clone(),
last_education: schema.last_education.clone(),
linkedin_url: schema.linkedin_url.clone(),
@@ -234,7 +230,6 @@ pub struct UsersDetailQueryDto {
pub gender: Option<String>,
pub birthdate: Option<String>,
pub domicile: Option<String>,
pub identity_document_url: Option<String>,
pub bio: Option<String>,
pub last_education: Option<String>,
pub linkedin_url: Option<String>,
@@ -263,7 +258,6 @@ impl UsersDetailQueryDto {
mentor_id: self.mentor_id.clone(),
gender: self.gender.clone(),
domicile: self.domicile.clone(),
identity_document_url: self.identity_document_url.clone(),
bio: self.bio.clone(),
last_education: self.last_education.clone(),
linkedin_url: self.linkedin_url.clone(),
@@ -294,7 +288,6 @@ impl From<&UsersDetailItemDto> for UsersDetailQueryDto {
gender: dto.gender.clone(),
birthdate: dto.birthdate.clone(),
domicile: dto.domicile.clone(),
identity_document_url: dto.identity_document_url.clone(),
bio: dto.bio.clone(),
last_education: dto.last_education.clone(),
linkedin_url: dto.linkedin_url.clone(),
-6
View File
@@ -29,8 +29,6 @@ pub struct UsersSchema {
#[serde(skip_serializing_if = "Option::is_none")]
pub domicile: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub identity_document_url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub bio: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub last_education: Option<String>,
@@ -70,7 +68,6 @@ impl Default for UsersSchema {
gender: None,
birthdate: None,
domicile: None,
identity_document_url: None,
bio: None,
last_education: None,
linkedin_url: None,
@@ -108,7 +105,6 @@ impl UsersSchema {
gender: dto.gender,
birthdate: dto.birthdate,
domicile: dto.domicile,
identity_document_url: dto.identity_document_url,
bio: dto.bio,
last_education: dto.last_education,
linkedin_url: dto.linkedin_url,
@@ -134,7 +130,6 @@ impl UsersSchema {
gender: user.gender,
birthdate: user.birthdate,
domicile: user.domicile,
identity_document_url: user.identity_document_url,
bio: user.bio,
last_education: user.last_education,
linkedin_url: user.linkedin_url,
@@ -170,7 +165,6 @@ impl UsersSchema {
gender: None,
birthdate: None,
domicile: None,
identity_document_url: None,
bio: None,
last_education: None,
linkedin_url: None,