chore: update user name with UserService

This commit is contained in:
appflowy
2022-07-03 16:52:06 +08:00
parent 6fc7f63a8b
commit ce73da8212
11 changed files with 81 additions and 49 deletions

View File

@ -2,7 +2,7 @@ use crate::{configuration::*, request::HttpRequestBuilder};
use flowy_error::FlowyError;
use flowy_user::event_map::UserCloudService;
use flowy_user_data_model::entities::{
SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserParams, UserProfile,
SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserProfileParams, UserProfile,
};
use http_flowy::errors::ServerError;
use lib_infra::future::FutureResult;
@ -42,7 +42,7 @@ impl UserCloudService for UserHttpCloudService {
})
}
fn update_user(&self, token: &str, params: UpdateUserParams) -> FutureResult<(), FlowyError> {
fn update_user(&self, token: &str, params: UpdateUserProfileParams) -> FutureResult<(), FlowyError> {
let token = token.to_owned();
let url = self.config.user_profile_url();
FutureResult::new(async move {
@ -101,7 +101,11 @@ pub async fn get_user_profile_request(token: &str, url: &str) -> Result<UserProf
Ok(user_profile)
}
pub async fn update_user_profile_request(token: &str, params: UpdateUserParams, url: &str) -> Result<(), ServerError> {
pub async fn update_user_profile_request(
token: &str,
params: UpdateUserProfileParams,
url: &str,
) -> Result<(), ServerError> {
let _ = request_builder()
.patch(&url.to_owned())
.header(HEADER_TOKEN, token)

View File

@ -264,7 +264,7 @@ use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision
use flowy_text_block::BlockCloudService;
use flowy_user::event_map::UserCloudService;
use flowy_user_data_model::entities::{
SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserParams, UserProfile,
SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserProfileParams, UserProfile,
};
use lib_infra::{future::FutureResult, util::timestamp};
@ -401,7 +401,7 @@ impl UserCloudService for LocalServer {
FutureResult::new(async { Ok(()) })
}
fn update_user(&self, _token: &str, _params: UpdateUserParams) -> FutureResult<(), FlowyError> {
fn update_user(&self, _token: &str, _params: UpdateUserProfileParams) -> FutureResult<(), FlowyError> {
FutureResult::new(async { Ok(()) })
}