feat(users): Add optional fields to user schemas and update user avatar functionality
This commit is contained in:
@@ -94,13 +94,23 @@ impl<'a> AuthRepository<'a> {
|
||||
Ok(UsersDetailQueryDto {
|
||||
id: Thing::from(("app_users".to_string(), email.clone())),
|
||||
fullname: "Cached User".to_string(),
|
||||
legal_name: None,
|
||||
email: cache.email,
|
||||
avatar: None,
|
||||
phone_number: String::new(),
|
||||
phone_for_verification: None,
|
||||
is_active: true,
|
||||
is_deleted: false,
|
||||
gender: None,
|
||||
birthdate: None,
|
||||
domicile: None,
|
||||
identity_document_url: None,
|
||||
bio: None,
|
||||
last_education: None,
|
||||
linkedin_url: None,
|
||||
github_url: None,
|
||||
cv_url: None,
|
||||
portfolio_url: None,
|
||||
password: String::new(),
|
||||
role: role_detail_query_dto,
|
||||
created_at: String::new(),
|
||||
|
||||
@@ -215,9 +215,15 @@ where
|
||||
// Update avatar if user doesn't have one and Google provides one
|
||||
if user.avatar.is_none() && google_user.picture.is_some() {
|
||||
info!("Updating avatar for existing user: {}", google_user.email);
|
||||
// Note: We would need to implement an update_user_avatar method in the user service
|
||||
// For now, we'll just log this
|
||||
info!("Avatar would be updated to: {:?}", google_user.picture);
|
||||
match self.users_service.update_user_avatar(&google_user.email, google_user.picture.clone()).await {
|
||||
Ok(_) => {
|
||||
info!("Successfully updated avatar for user: {}", google_user.email);
|
||||
user.avatar = google_user.picture.clone();
|
||||
},
|
||||
Err(e) => {
|
||||
error!("Failed to update avatar for user {}: {:?}", google_user.email, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
user
|
||||
|
||||
Reference in New Issue
Block a user