Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
rename user detail
appflowy9771066d8061
diff --git a/app_flowy/lib/user/application/sign_in/sign_in_bloc.dart b/app_flowy/lib/user/application/sign_in/sign_in_bloc.dartindex 6ddc57403f..0bd9f1660e 100644--- a/app_flowy/lib/user/application/sign_in/sign_in_bloc.dart+++ b/app_flowy/lib/user/application/sign_in/sign_in_bloc.dart@@ -35,8 +35,8 @@ class SignInBloc extends Bloc<SignInEvent, SignInState> {final result = await authImpl.signIn(state.email, state.password);yield result.fold(- (userDetail) => state.copyWith(- isSubmitting: false, successOrFail: some(left(userDetail))),+ (UserProfile) => state.copyWith(+ isSubmitting: false, successOrFail: some(left(UserProfile))),(error) => stateFromCode(error),);}@@ -76,7 +76,7 @@ abstract class SignInState with _$SignInState {required bool isSubmitting,required Option<String> passwordError,required Option<String> emailError,- required Option<Either<UserDetail, UserError>> successOrFail,+ required Option<Either<UserProfile, UserError>> successOrFail,}) = _SignInState;factory SignInState.initial() => SignInState(diff --git a/app_flowy/lib/user/application/sign_in/sign_in_bloc.freezed.dart b/app_flowy/lib/user/application/sign_in/sign_in_bloc.freezed.dartindex 8a795a2307..c2add8b145 100644--- a/app_flowy/lib/user/application/sign_in/sign_in_bloc.freezed.dart+++ b/app_flowy/lib/user/application/sign_in/sign_in_bloc.freezed.dart@@ -440,7 +440,7 @@ class _$SignInStateTearOff {required bool isSubmitting,required Option<String> passwordError,required Option<String> emailError,- required Option<Either<UserDetail, UserError>> successOrFail}) {+ required Option<Either<UserProfile, UserError>> successOrFail}) {return _SignInState(email: email,password: password,@@ -462,7 +462,7 @@ mixin _$SignInState {bool get isSubmitting => throw _privateConstructorUsedError;Option<String> get passwordError => throw _privateConstructorUsedError;Option<String> get emailError => throw _privateConstructorUsedError;- Option<Either<UserDetail, UserError>> get successOrFail =>+ Option<Either<UserProfile, UserError>> get successOrFail =>throw _privateConstructorUsedError;@JsonKey(ignore: true)@@ -481,7 +481,7 @@ abstract class $SignInStateCopyWith<$Res> {bool isSubmitting,Option<String> passwordError,Option<String> emailError,- Option<Either<UserDetail, UserError>> successOrFail});+ Option<Either<UserProfile, UserError>> successOrFail});}/// @nodoc@@ -525,7 +525,7 @@ class _$SignInStateCopyWithImpl<$Res> implements $SignInStateCopyWith<$Res> {successOrFail: successOrFail == freezed? _value.successOrFail: successOrFail // ignore: cast_nullable_to_non_nullable- as Option<Either<UserDetail, UserError>>,+ as Option<Either<UserProfile, UserError>>,));}}@@ -543,7 +543,7 @@ abstract class _$SignInStateCopyWith<$Res>bool isSubmitting,Option<String> passwordError,Option<String> emailError,- Option<Either<UserDetail, UserError>> successOrFail});+ Option<Either<UserProfile, UserError>> successOrFail});}/// @nodoc@@ -589,7 +589,7 @@ class __$SignInStateCopyWithImpl<$Res> extends _$SignInStateCopyWithImpl<$Res>successOrFail: successOrFail == freezed? _value.successOrFail: successOrFail // ignore: cast_nullable_to_non_nullable- as Option<Either<UserDetail, UserError>>,+ as Option<Either<UserProfile, UserError>>,));}}@@ -616,7 +616,7 @@ class _$_SignInState implements _SignInState {@overridefinal Option<String> emailError;@override- final Option<Either<UserDetail, UserError>> successOrFail;+ final Option<Either<UserProfile, UserError>> successOrFail;@overrideString toString() {@@ -669,7 +669,7 @@ abstract class _SignInState implements SignInState {required bool isSubmitting,required Option<String> passwordError,required Option<String> emailError,- required Option<Either<UserDetail, UserError>> successOrFail}) =+ required Option<Either<UserProfile, UserError>> successOrFail}) =_$_SignInState;@override@@ -683,7 +683,7 @@ abstract class _SignInState implements SignInState {@overrideOption<String> get emailError => throw _privateConstructorUsedError;@override- Option<Either<UserDetail, UserError>> get successOrFail =>+ Option<Either<UserProfile, UserError>> get successOrFail =>throw _privateConstructorUsedError;@override@JsonKey(ignore: true)diff --git a/app_flowy/lib/user/domain/i_auth.dart b/app_flowy/lib/user/domain/i_auth.dartindex 30d13173b2..ced8f2ecf2 100644--- a/app_flowy/lib/user/domain/i_auth.dart+++ b/app_flowy/lib/user/domain/i_auth.dart@@ -3,15 +3,16 @@ import 'package:dartz/dartz.dart';import 'package:flutter/material.dart';abstract class IAuth {- Future<Either<UserDetail, UserError>> signIn(String? email, String? password);- Future<Either<UserDetail, UserError>> signUp(+ Future<Either<UserProfile, UserError>> signIn(+ String? email, String? password);+ Future<Either<UserProfile, UserError>> signUp(String? name, String? password, String? email);Future<Either<Unit, UserError>> signOut();}abstract class IAuthRouter {- void showWorkspaceSelectScreen(BuildContext context, UserDetail user);+ void showWorkspaceSelectScreen(BuildContext context, UserProfile user);void showSignUpScreen(BuildContext context);void showForgetPasswordScreen(BuildContext context);}diff --git a/app_flowy/lib/user/infrastructure/i_auth_impl.dart b/app_flowy/lib/user/infrastructure/i_auth_impl.dartindex e89f4aca01..5bdb8defcd 100644--- a/app_flowy/lib/user/infrastructure/i_auth_impl.dart+++ b/app_flowy/lib/user/infrastructure/i_auth_impl.dart@@ -14,13 +14,13 @@ class AuthImpl extends IAuth {});@override- Future<Either<UserDetail, UserError>> signIn(+ Future<Either<UserProfile, UserError>> signIn(String? email, String? password) {return repo.signIn(email: email, password: password);}@override- Future<Either<UserDetail, UserError>> signUp(+ Future<Either<UserProfile, UserError>> signUp(String? name, String? password, String? email) {return repo.signUp(name: name, password: password, email: email);}@@ -38,7 +38,7 @@ class AuthRouterImpl extends IAuthRouter {}@override- void showWorkspaceSelectScreen(BuildContext context, UserDetail user) {+ void showWorkspaceSelectScreen(BuildContext context, UserProfile user) {Navigator.of(context).push(PageRoutes.fade(() => WorkspaceSelectScreen(diff --git a/app_flowy/lib/user/infrastructure/repos/auth_repo.dart b/app_flowy/lib/user/infrastructure/repos/auth_repo.dartindex 4f9b091c5f..4b71b85c1c 100644--- a/app_flowy/lib/user/infrastructure/repos/auth_repo.dart+++ b/app_flowy/lib/user/infrastructure/repos/auth_repo.dart@@ -3,7 +3,7 @@ import 'package:flowy_sdk/dispatch/dispatch.dart';import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart';class AuthRepository {- Future<Either<UserDetail, UserError>> signIn(+ Future<Either<UserProfile, UserError>> signIn({required String? email, required String? password}) {//final request = SignInRequest.create()@@ -13,7 +13,7 @@ class AuthRepository {return UserEventSignIn(request).send();}- Future<Either<UserDetail, UserError>> signUp(+ Future<Either<UserProfile, UserError>> signUp({required String? name,required String? password,required String? email}) {diff --git a/app_flowy/lib/user/presentation/sign_in/sign_in_screen.dart b/app_flowy/lib/user/presentation/sign_in/sign_in_screen.dartindex ddb88b4a3a..a1ca6ffc0e 100644--- a/app_flowy/lib/user/presentation/sign_in/sign_in_screen.dart+++ b/app_flowy/lib/user/presentation/sign_in/sign_in_screen.dart@@ -6,7 +6,7 @@ import 'package:flowy_infra_ui/widget/rounded_button.dart';import 'package:flowy_infra_ui/widget/rounded_input_field.dart';import 'package:flowy_infra_ui/widget/spacing.dart';import 'package:flowy_sdk/protobuf/flowy-user/errors.pb.dart';-import 'package:flowy_sdk/protobuf/flowy-user/user_detail.pb.dart';+import 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart';import 'package:flutter/material.dart';import 'package:flutter_bloc/flutter_bloc.dart';import 'package:dartz/dartz.dart';@@ -34,7 +34,7 @@ class SignInScreen extends StatelessWidget {}void _handleSuccessOrFail(- Either<UserDetail, UserError> result, BuildContext context) {+ Either<UserProfile, UserError> result, BuildContext context) {result.fold((user) => router.showWorkspaceSelectScreen(context, user),(error) => _showErrorMessage(context, error.msg),diff --git a/app_flowy/lib/welcome/application/welcome_bloc.dart b/app_flowy/lib/welcome/application/welcome_bloc.dartindex bb157d9078..c69a28a0d3 100644--- a/app_flowy/lib/welcome/application/welcome_bloc.dart+++ b/app_flowy/lib/welcome/application/welcome_bloc.dart@@ -13,7 +13,7 @@ class WelcomeBloc extends Bloc<WelcomeEvent, WelcomeState> {Stream<WelcomeState> mapEventToState(WelcomeEvent event) async* {yield* event.map(getUser: (val) async* {- final authState = await authImpl.currentUserDetail();+ final authState = await authImpl.currentUserProfile();yield state.copyWith(auth: authState);},);diff --git a/app_flowy/lib/welcome/domain/auth_state.dart b/app_flowy/lib/welcome/domain/auth_state.dartindex b8fb0c7456..12c6541681 100644--- a/app_flowy/lib/welcome/domain/auth_state.dart+++ b/app_flowy/lib/welcome/domain/auth_state.dart@@ -4,7 +4,8 @@ part 'auth_state.freezed.dart';@freezedabstract class AuthState with _$AuthState {- const factory AuthState.authenticated(UserDetail userDetail) = Authenticated;+ const factory AuthState.authenticated(UserProfile userProfile) =+ Authenticated;const factory AuthState.unauthenticated(UserError error) = Unauthenticated;const factory AuthState.initial() = _Initial;}diff --git a/app_flowy/lib/welcome/domain/auth_state.freezed.dart b/app_flowy/lib/welcome/domain/auth_state.freezed.dartindex 874d652925..af6f7b385f 100644--- a/app_flowy/lib/welcome/domain/auth_state.freezed.dart+++ b/app_flowy/lib/welcome/domain/auth_state.freezed.dart@@ -16,9 +16,9 @@ final _privateConstructorUsedError = UnsupportedError(class _$AuthStateTearOff {const _$AuthStateTearOff();- Authenticated authenticated(UserDetail userDetail) {+ Authenticated authenticated(UserProfile userProfile) {return Authenticated(- userDetail,+ userProfile,);}@@ -40,14 +40,14 @@ const $AuthState = _$AuthStateTearOff();mixin _$AuthState {@optionalTypeArgsTResult when<TResult extends Object?>({- required TResult Function(UserDetail userDetail) authenticated,+ required TResult Function(UserProfile userProfile) authenticated,required TResult Function(UserError error) unauthenticated,required TResult Function() initial,}) =>throw _privateConstructorUsedError;@optionalTypeArgsTResult maybeWhen<TResult extends Object?>({- TResult Function(UserDetail userDetail)? authenticated,+ TResult Function(UserProfile userProfile)? authenticated,TResult Function(UserError error)? unauthenticated,TResult Function()? initial,required TResult orElse(),@@ -90,7 +90,7 @@ abstract class $AuthenticatedCopyWith<$Res> {factory $AuthenticatedCopyWith(Authenticated value, $Res Function(Authenticated) then) =_$AuthenticatedCopyWithImpl<$Res>;- $Res call({UserDetail userDetail});+ $Res call({UserProfile userProfile});}/// @nodoc@@ -105,13 +105,13 @@ class _$AuthenticatedCopyWithImpl<$Res> extends _$AuthStateCopyWithImpl<$Res>@override$Res call({- Object? userDetail = freezed,+ Object? userProfile = freezed,}) {return _then(Authenticated(- userDetail == freezed- ? _value.userDetail- : userDetail // ignore: cast_nullable_to_non_nullable- as UserDetail,+ userProfile == freezed+ ? _value.userProfile+ : userProfile // ignore: cast_nullable_to_non_nullable+ as UserProfile,));}}@@ -119,28 +119,28 @@ class _$AuthenticatedCopyWithImpl<$Res> extends _$AuthStateCopyWithImpl<$Res>/// @nodocclass _$Authenticated implements Authenticated {- const _$Authenticated(this.userDetail);+ const _$Authenticated(this.userProfile);@override- final UserDetail userDetail;+ final UserProfile userProfile;@overrideString toString() {- return 'AuthState.authenticated(userDetail: $userDetail)';+ return 'AuthState.authenticated(userProfile: $userProfile)';}@overridebool operator ==(dynamic other) {return identical(this, other) ||(other is Authenticated &&- (identical(other.userDetail, userDetail) ||+ (identical(other.userProfile, userProfile) ||const DeepCollectionEquality()- .equals(other.userDetail, userDetail)));+ .equals(other.userProfile, userProfile)));}@overrideint get hashCode =>- runtimeType.hashCode ^ const DeepCollectionEquality().hash(userDetail);+ runtimeType.hashCode ^ const DeepCollectionEquality().hash(userProfile);@JsonKey(ignore: true)@override@@ -150,23 +150,23 @@ class _$Authenticated implements Authenticated {@override@optionalTypeArgsTResult when<TResult extends Object?>({- required TResult Function(UserDetail userDetail) authenticated,+ required TResult Function(UserProfile userProfile) authenticated,required TResult Function(UserError error) unauthenticated,required TResult Function() initial,}) {- return authenticated(userDetail);+ return authenticated(userProfile);}@override@optionalTypeArgsTResult maybeWhen<TResult extends Object?>({- TResult Function(UserDetail userDetail)? authenticated,+ TResult Function(UserProfile userProfile)? authenticated,TResult Function(UserError error)? unauthenticated,TResult Function()? initial,required TResult orElse(),}) {if (authenticated != null) {- return authenticated(userDetail);+ return authenticated(userProfile);}return orElse();}@@ -197,9 +197,9 @@ class _$Authenticated implements Authenticated {}abstract class Authenticated implements AuthState {- const factory Authenticated(UserDetail userDetail) = _$Authenticated;+ const factory Authenticated(UserProfile userProfile) = _$Authenticated;- UserDetail get userDetail => throw _privateConstructorUsedError;+ UserProfile get userProfile => throw _privateConstructorUsedError;@JsonKey(ignore: true)$AuthenticatedCopyWith<Authenticated> get copyWith =>throw _privateConstructorUsedError;@@ -269,7 +269,7 @@ class _$Unauthenticated implements Unauthenticated {@override@optionalTypeArgsTResult when<TResult extends Object?>({- required TResult Function(UserDetail userDetail) authenticated,+ required TResult Function(UserProfile userProfile) authenticated,required TResult Function(UserError error) unauthenticated,required TResult Function() initial,}) {@@ -279,7 +279,7 @@ class _$Unauthenticated implements Unauthenticated {@override@optionalTypeArgsTResult maybeWhen<TResult extends Object?>({- TResult Function(UserDetail userDetail)? authenticated,+ TResult Function(UserProfile userProfile)? authenticated,TResult Function(UserError error)? unauthenticated,TResult Function()? initial,required TResult orElse(),@@ -361,7 +361,7 @@ class _$_Initial implements _Initial {@override@optionalTypeArgsTResult when<TResult extends Object?>({- required TResult Function(UserDetail userDetail) authenticated,+ required TResult Function(UserProfile userProfile) authenticated,required TResult Function(UserError error) unauthenticated,required TResult Function() initial,}) {@@ -371,7 +371,7 @@ class _$_Initial implements _Initial {@override@optionalTypeArgsTResult maybeWhen<TResult extends Object?>({- TResult Function(UserDetail userDetail)? authenticated,+ TResult Function(UserProfile userProfile)? authenticated,TResult Function(UserError error)? unauthenticated,TResult Function()? initial,required TResult orElse(),diff --git a/app_flowy/lib/welcome/domain/i_welcome.dart b/app_flowy/lib/welcome/domain/i_welcome.dartindex 7fe5266489..fec687ea25 100644--- a/app_flowy/lib/welcome/domain/i_welcome.dart+++ b/app_flowy/lib/welcome/domain/i_welcome.dart@@ -4,10 +4,10 @@ import 'package:flutter/widgets.dart';import 'auth_state.dart';abstract class IWelcomeAuth {- Future<AuthState> currentUserDetail();+ Future<AuthState> currentUserProfile();}abstract class IWelcomeRoute {Widget pushSignInScreen();- Future<void> pushHomeScreen(BuildContext context, UserDetail userDetail);+ Future<void> pushHomeScreen(BuildContext context, UserProfile profile);}diff --git a/app_flowy/lib/welcome/infrastructure/i_welcome_impl.dart b/app_flowy/lib/welcome/infrastructure/i_welcome_impl.dartindex cbfad2beaf..0d48cb80e6 100644--- a/app_flowy/lib/welcome/infrastructure/i_welcome_impl.dart+++ b/app_flowy/lib/welcome/infrastructure/i_welcome_impl.dart@@ -18,12 +18,12 @@ export 'package:app_flowy/welcome/domain/i_welcome.dart';class WelcomeAuthImpl implements IWelcomeAuth {@override- Future<AuthState> currentUserDetail() {- final result = UserEventGetStatus().send();+ Future<AuthState> currentUserProfile() {+ final result = UserEventGetUserProfile().send();return result.then((result) {return result.fold(- (userDetail) {- return AuthState.authenticated(userDetail);+ (UserProfile) {+ return AuthState.authenticated(UserProfile);},(userError) {return AuthState.unauthenticated(userError);@@ -35,7 +35,7 @@ class WelcomeAuthImpl implements IWelcomeAuth {class WelcomeRoute implements IWelcomeRoute {@override- Future<void> pushHomeScreen(BuildContext context, UserDetail user) async {+ Future<void> pushHomeScreen(BuildContext context, UserProfile user) async {final repo = UserRepo(user: user);return WorkspaceEventReadCurWorkspace().send().then((result) {diff --git a/app_flowy/lib/welcome/presentation/welcome_screen.dart b/app_flowy/lib/welcome/presentation/welcome_screen.dartindex dad0d78248..2bd89cf92c 100644--- a/app_flowy/lib/welcome/presentation/welcome_screen.dart+++ b/app_flowy/lib/welcome/presentation/welcome_screen.dart@@ -41,7 +41,7 @@ class WelcomeScreen extends StatelessWidget {}void _handleAuthenticated(BuildContext context, Authenticated result) {- getIt<IWelcomeRoute>().pushHomeScreen(context, result.userDetail);+ getIt<IWelcomeRoute>().pushHomeScreen(context, result.userProfile);}void _handleUnauthenticated(BuildContext context, Unauthenticated result) {diff --git a/app_flowy/lib/workspace/application/menu/menu_user_bloc.dart b/app_flowy/lib/workspace/application/menu/menu_user_bloc.dartindex b4501e4bed..56682277f7 100644--- a/app_flowy/lib/workspace/application/menu/menu_user_bloc.dart+++ b/app_flowy/lib/workspace/application/menu/menu_user_bloc.dart@@ -1,5 +1,5 @@import 'package:app_flowy/workspace/domain/i_user.dart';-import 'package:flowy_sdk/protobuf/flowy-user/user_detail.pb.dart';+import 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/workspace_create.pb.dart';import 'package:flutter_bloc/flutter_bloc.dart';import 'package:freezed_annotation/freezed_annotation.dart';@@ -47,12 +47,12 @@ class MenuUserEvent with _$MenuUserEvent {@freezedclass MenuUserState with _$MenuUserState {const factory MenuUserState({- required UserDetail user,+ required UserProfile user,required Option<List<Workspace>> workspaces,required Either<Unit, String> successOrFailure,}) = _MenuUserState;- factory MenuUserState.initial(UserDetail user) => MenuUserState(+ factory MenuUserState.initial(UserProfile user) => MenuUserState(user: user,workspaces: none(),successOrFailure: left(unit),diff --git a/app_flowy/lib/workspace/application/menu/menu_user_bloc.freezed.dart b/app_flowy/lib/workspace/application/menu/menu_user_bloc.freezed.dartindex b1cffe2de2..d9d2bf0aec 100644--- a/app_flowy/lib/workspace/application/menu/menu_user_bloc.freezed.dart+++ b/app_flowy/lib/workspace/application/menu/menu_user_bloc.freezed.dart@@ -249,7 +249,7 @@ class _$MenuUserStateTearOff {const _$MenuUserStateTearOff();_MenuUserState call(- {required UserDetail user,+ {required UserProfile user,required Option<List<Workspace>> workspaces,required Either<Unit, String> successOrFailure}) {return _MenuUserState(@@ -265,7 +265,7 @@ const $MenuUserState = _$MenuUserStateTearOff();/// @nodocmixin _$MenuUserState {- UserDetail get user => throw _privateConstructorUsedError;+ UserProfile get user => throw _privateConstructorUsedError;Option<List<Workspace>> get workspaces => throw _privateConstructorUsedError;Either<Unit, String> get successOrFailure =>throw _privateConstructorUsedError;@@ -281,7 +281,7 @@ abstract class $MenuUserStateCopyWith<$Res> {MenuUserState value, $Res Function(MenuUserState) then) =_$MenuUserStateCopyWithImpl<$Res>;$Res call(- {UserDetail user,+ {UserProfile user,Option<List<Workspace>> workspaces,Either<Unit, String> successOrFailure});}@@ -305,7 +305,7 @@ class _$MenuUserStateCopyWithImpl<$Res>user: user == freezed? _value.user: user // ignore: cast_nullable_to_non_nullable- as UserDetail,+ as UserProfile,workspaces: workspaces == freezed? _value.workspaces: workspaces // ignore: cast_nullable_to_non_nullable@@ -326,7 +326,7 @@ abstract class _$MenuUserStateCopyWith<$Res>__$MenuUserStateCopyWithImpl<$Res>;@override$Res call(- {UserDetail user,+ {UserProfile user,Option<List<Workspace>> workspaces,Either<Unit, String> successOrFailure});}@@ -352,7 +352,7 @@ class __$MenuUserStateCopyWithImpl<$Res>user: user == freezed? _value.user: user // ignore: cast_nullable_to_non_nullable- as UserDetail,+ as UserProfile,workspaces: workspaces == freezed? _value.workspaces: workspaces // ignore: cast_nullable_to_non_nullable@@ -374,7 +374,7 @@ class _$_MenuUserState implements _MenuUserState {required this.successOrFailure});@override- final UserDetail user;+ final UserProfile user;@overridefinal Option<List<Workspace>> workspaces;@override@@ -414,12 +414,12 @@ class _$_MenuUserState implements _MenuUserState {abstract class _MenuUserState implements MenuUserState {const factory _MenuUserState(- {required UserDetail user,+ {required UserProfile user,required Option<List<Workspace>> workspaces,required Either<Unit, String> successOrFailure}) = _$_MenuUserState;@override- UserDetail get user => throw _privateConstructorUsedError;+ UserProfile get user => throw _privateConstructorUsedError;@overrideOption<List<Workspace>> get workspaces => throw _privateConstructorUsedError;@overridediff --git a/app_flowy/lib/workspace/domain/i_user.dart b/app_flowy/lib/workspace/domain/i_user.dartindex 6ffbe9d546..0bf887604d 100644--- a/app_flowy/lib/workspace/domain/i_user.dart+++ b/app_flowy/lib/workspace/domain/i_user.dart@@ -1,12 +1,12 @@import 'package:dartz/dartz.dart';import 'package:flowy_sdk/protobuf/flowy-user/errors.pb.dart';-import 'package:flowy_sdk/protobuf/flowy-user/user_detail.pb.dart';+import 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/workspace_create.pb.dart';export 'package:flowy_sdk/protobuf/flowy-workspace/workspace_create.pb.dart';export 'package:flowy_sdk/protobuf/flowy-user/errors.pb.dart';-export 'package:flowy_sdk/protobuf/flowy-user/user_detail.pb.dart';+export 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart';typedef UserCreateWorkspaceCallback = void Function(Either<List<Workspace>, WorkspaceError> workspacesOrFailed);@@ -14,8 +14,8 @@ typedef UserDeleteWorkspaceCallback = void Function(Either<List<Workspace>, WorkspaceError> workspacesOrFailed);abstract class IUser {- UserDetail get user;- Future<Either<UserDetail, UserError>> fetchUserDetail(String userId);+ UserProfile get user;+ Future<Either<UserProfile, UserError>> fetchUserProfile(String userId);Future<Either<List<Workspace>, WorkspaceError>> fetchWorkspaces();Future<Either<Unit, WorkspaceError>> deleteWorkspace(String workspaceId);Future<Either<Unit, UserError>> signOut();diff --git a/app_flowy/lib/workspace/infrastructure/deps_resolver.dart b/app_flowy/lib/workspace/infrastructure/deps_resolver.dartindex ac6cea5fec..94185f4552 100644--- a/app_flowy/lib/workspace/infrastructure/deps_resolver.dart+++ b/app_flowy/lib/workspace/infrastructure/deps_resolver.dart@@ -18,7 +18,7 @@ import 'package:app_flowy/workspace/infrastructure/repos/doc_repo.dart';import 'package:app_flowy/workspace/infrastructure/repos/view_repo.dart';import 'package:app_flowy/workspace/infrastructure/repos/workspace_repo.dart';import 'package:flowy_editor/flowy_editor.dart';-import 'package:flowy_sdk/protobuf/flowy-user/user_detail.pb.dart';+import 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';import 'package:get_it/get_it.dart';@@ -37,10 +37,10 @@ class HomeDepsResolver {(appId, _) => IAppWatchImpl(repo: AppWatchRepository(appId: appId)));//workspace- getIt.registerFactoryParam<IWorkspace, UserDetail, String>(+ getIt.registerFactoryParam<IWorkspace, UserProfile, String>((user, workspaceId) => IWorkspaceImpl(repo: WorkspaceRepo(user: user, workspaceId: workspaceId)));- getIt.registerFactoryParam<IWorkspaceWatch, UserDetail, String>(+ getIt.registerFactoryParam<IWorkspaceWatch, UserProfile, String>((user, workspaceId) => IWorkspaceWatchImpl(repo: WorkspaceWatchRepo(user: user, workspaceId: workspaceId)));@@ -55,20 +55,20 @@ class HomeDepsResolver {(docId, _) => IDocImpl(repo: DocRepository(docId: docId)));// User- getIt.registerFactoryParam<IUser, UserDetail, void>(+ getIt.registerFactoryParam<IUser, UserProfile, void>((user, _) => IUserImpl(repo: UserRepo(user: user)));- getIt.registerFactoryParam<IUserWatch, UserDetail, void>(+ getIt.registerFactoryParam<IUserWatch, UserProfile, void>((user, _) => IUserWatchImpl(repo: UserWatchRepo(user: user)));//Menu Bloc- getIt.registerFactoryParam<MenuBloc, UserDetail, String>(+ getIt.registerFactoryParam<MenuBloc, UserProfile, String>((user, workspaceId) =>MenuBloc(getIt<IWorkspace>(param1: user, param2: workspaceId)));- getIt.registerFactoryParam<MenuWatchBloc, UserDetail, String>(+ getIt.registerFactoryParam<MenuWatchBloc, UserProfile, String>((user, workspaceId) => MenuWatchBloc(getIt<IWorkspaceWatch>(param1: user, param2: workspaceId)));- getIt.registerFactoryParam<MenuUserBloc, UserDetail, void>(+ getIt.registerFactoryParam<MenuUserBloc, UserProfile, void>((user, _) => MenuUserBloc(getIt<IUser>(param1: user)));//diff --git a/app_flowy/lib/workspace/infrastructure/i_user_impl.dart b/app_flowy/lib/workspace/infrastructure/i_user_impl.dartindex 106a8b65c9..22d4d40508 100644--- a/app_flowy/lib/workspace/infrastructure/i_user_impl.dart+++ b/app_flowy/lib/workspace/infrastructure/i_user_impl.dart@@ -17,8 +17,8 @@ class IUserImpl extends IUser {}@override- Future<Either<UserDetail, UserError>> fetchUserDetail(String userId) {- return repo.fetchUserDetail(userId: userId);+ Future<Either<UserProfile, UserError>> fetchUserProfile(String userId) {+ return repo.fetchUserProfile(userId: userId);}@override@@ -27,7 +27,7 @@ class IUserImpl extends IUser {}@override- UserDetail get user => repo.user;+ UserProfile get user => repo.user;@overrideFuture<Either<List<Workspace>, WorkspaceError>> fetchWorkspaces() {diff --git a/app_flowy/lib/workspace/infrastructure/repos/user_repo.dart b/app_flowy/lib/workspace/infrastructure/repos/user_repo.dartindex d638e15de4..301b645334 100644--- a/app_flowy/lib/workspace/infrastructure/repos/user_repo.dart+++ b/app_flowy/lib/workspace/infrastructure/repos/user_repo.dart@@ -4,7 +4,7 @@ import 'package:dartz/dartz.dart';import 'package:flowy_sdk/dispatch/dispatch.dart';import 'package:flowy_sdk/protobuf/flowy-observable/subject.pb.dart';import 'package:flowy_sdk/protobuf/flowy-user/errors.pb.dart';-import 'package:flowy_sdk/protobuf/flowy-user/user_detail.pb.dart';+import 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/observable.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/workspace_create.pb.dart';@@ -13,14 +13,14 @@ import 'package:flowy_sdk/rust_stream.dart';import 'package:app_flowy/workspace/domain/i_user.dart';class UserRepo {- final UserDetail user;+ final UserProfile user;UserRepo({required this.user,});- Future<Either<UserDetail, UserError>> fetchUserDetail(+ Future<Either<UserProfile, UserError>> fetchUserProfile({required String userId}) {- return UserEventGetStatus().send();+ return UserEventGetUserProfile().send();}Future<Either<Unit, WorkspaceError>> deleteWorkspace(@@ -73,7 +73,7 @@ class UserWatchRepo {UserDeleteWorkspaceCallback? _deleteWorkspace;late UserRepo _repo;UserWatchRepo({- required UserDetail user,+ required UserProfile user,}) {_repo = UserRepo(user: user);}diff --git a/app_flowy/lib/workspace/infrastructure/repos/workspace_repo.dart b/app_flowy/lib/workspace/infrastructure/repos/workspace_repo.dartindex ef8eb90b41..b50934fbf7 100644--- a/app_flowy/lib/workspace/infrastructure/repos/workspace_repo.dart+++ b/app_flowy/lib/workspace/infrastructure/repos/workspace_repo.dart@@ -4,7 +4,7 @@ import 'package:dartz/dartz.dart';import 'package:flowy_infra/flowy_logger.dart';import 'package:flowy_sdk/dispatch/dispatch.dart';import 'package:flowy_sdk/protobuf/flowy-observable/subject.pb.dart';-import 'package:flowy_sdk/protobuf/flowy-user/user_detail.pb.dart';+import 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/app_create.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/observable.pb.dart';@@ -15,7 +15,7 @@ import 'package:flowy_sdk/rust_stream.dart';import 'package:app_flowy/workspace/domain/i_workspace.dart';class WorkspaceRepo {- UserDetail user;+ UserProfile user;String workspaceId;WorkspaceRepo({required this.user,@@ -64,7 +64,7 @@ class WorkspaceWatchRepo {WorkspaceCreateAppCallback? _createApp;WorkspaceDeleteAppCallback? _deleteApp;WorkspaceUpdatedCallback? _update;- final UserDetail user;+ final UserProfile user;final String workspaceId;late WorkspaceRepo _repo;diff --git a/app_flowy/lib/workspace/presentation/home/home_screen.dart b/app_flowy/lib/workspace/presentation/home/home_screen.dartindex f135f7d160..d1bce50918 100644--- a/app_flowy/lib/workspace/presentation/home/home_screen.dart+++ b/app_flowy/lib/workspace/presentation/home/home_screen.dart@@ -14,7 +14,7 @@ import 'home_layout.dart';class HomeScreen extends StatelessWidget {static GlobalKey<ScaffoldState> scaffoldKey = GlobalKey();- final UserDetail user;+ final UserProfile user;final String workspaceId;const HomeScreen(this.user, this.workspaceId, {Key? key}) : super(key: key);diff --git a/app_flowy/lib/workspace/presentation/widgets/menu/menu_page.dart b/app_flowy/lib/workspace/presentation/widgets/menu/menu_page.dartindex b03125d1f4..126cacdbe3 100644--- a/app_flowy/lib/workspace/presentation/widgets/menu/menu_page.dart+++ b/app_flowy/lib/workspace/presentation/widgets/menu/menu_page.dart@@ -3,7 +3,7 @@ import 'package:app_flowy/workspace/presentation/widgets/menu/menu_top_bar.dart'import 'package:dartz/dartz.dart';import 'package:flowy_infra/size.dart';import 'package:flowy_infra_ui/widget/error_page.dart';-import 'package:flowy_sdk/protobuf/flowy-user/user_detail.pb.dart';+import 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/app_create.pb.dart';import 'package:flutter/material.dart';import 'package:flutter_bloc/flutter_bloc.dart';@@ -22,7 +22,7 @@ import 'menu_list.dart';class HomeMenu extends StatelessWidget {final Function(HomeStackView?) pageContextChanged;final Function(bool) isCollapseChanged;- final UserDetail user;+ final UserProfile user;final String workspaceId;const HomeMenu({@@ -126,7 +126,7 @@ class MenuItemBuilder {MenuItemBuilder();- MenuItemBuilder withUser(UserDetail user) {+ MenuItemBuilder withUser(UserProfile user) {items.add(MenuUser(user));return this;}diff --git a/app_flowy/lib/workspace/presentation/widgets/menu/menu_user.dart b/app_flowy/lib/workspace/presentation/widgets/menu/menu_user.dartindex 6aff0b444e..bdc41bde8f 100644--- a/app_flowy/lib/workspace/presentation/widgets/menu/menu_user.dart+++ b/app_flowy/lib/workspace/presentation/widgets/menu/menu_user.dart@@ -2,14 +2,14 @@ import 'package:app_flowy/startup/startup.dart';import 'package:app_flowy/workspace/application/menu/menu_user_bloc.dart';import 'package:app_flowy/workspace/presentation/widgets/menu/menu_list.dart';import 'package:flowy_infra_ui/widget/spacing.dart';-import 'package:flowy_sdk/protobuf/flowy-user/user_detail.pb.dart';+import 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart';import 'package:flutter/material.dart';import 'package:flutter_bloc/flutter_bloc.dart';import 'package:flowy_infra_ui/style_widget/text.dart';import 'package:flowy_infra_ui/style_widget/icon_button.dart';class MenuUser extends MenuItem {- final UserDetail user;+ final UserProfile user;MenuUser(this.user, {Key? key}) : super(key: ValueKey(user.id));@overridediff --git a/app_flowy/lib/workspace/presentation/workspace/workspace_select_screen.dart b/app_flowy/lib/workspace/presentation/workspace/workspace_select_screen.dartindex e6a3f61f8c..120d8950d4 100644--- a/app_flowy/lib/workspace/presentation/workspace/workspace_select_screen.dart+++ b/app_flowy/lib/workspace/presentation/workspace/workspace_select_screen.dart@@ -132,7 +132,7 @@ class WorkspaceItem extends StatelessWidget {// }// class WorkspaceSelectScreen extends StatelessWidget {-// final UserDetail user;+// final UserProfile user;// const WorkspaceSelectScreen({// Key? key,// required this.user,@@ -206,7 +206,7 @@ class WorkspaceItem extends StatelessWidget {// }//// class WorkspaceSelectScreen extends StatelessWidget {-// final UserDetail user;+// final UserProfile user;// const WorkspaceSelectScreen({// Key? key,// required this.user,diff --git a/app_flowy/packages/flowy_sdk/lib/dispatch/code_gen.dart b/app_flowy/packages/flowy_sdk/lib/dispatch/code_gen.dartindex 25ae47f0b0..6f5e6ac10b 100644--- a/app_flowy/packages/flowy_sdk/lib/dispatch/code_gen.dart+++ b/app_flowy/packages/flowy_sdk/lib/dispatch/code_gen.dart@@ -1,369 +1,369 @@++/// Auto gen code from rust ast, do not editpart of 'dispatch.dart';-class WorkspaceEventCreateWorkspace {- CreateWorkspaceRequest request;- WorkspaceEventCreateWorkspace(this.request);+ CreateWorkspaceRequest request;+ WorkspaceEventCreateWorkspace(this.request);- Future<Either<Workspace, WorkspaceError>> send() {+ Future<Either<Workspace, WorkspaceError>> send() {final request = FFIRequest.create()- ..event = WorkspaceEvent.CreateWorkspace.toString()- ..payload = requestToBytes(this.request);+ ..event = WorkspaceEvent.CreateWorkspace.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (okBytes) => left(Workspace.fromBuffer(okBytes)),- (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),- ));- }+ (okBytes) => left(Workspace.fromBuffer(okBytes)),+ (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),+ ));+ }}class WorkspaceEventReadCurWorkspace {- WorkspaceEventReadCurWorkspace();+ WorkspaceEventReadCurWorkspace();- Future<Either<Workspace, WorkspaceError>> send() {- final request = FFIRequest.create()- ..event = WorkspaceEvent.ReadCurWorkspace.toString();+ Future<Either<Workspace, WorkspaceError>> send() {+ final request = FFIRequest.create()+ ..event = WorkspaceEvent.ReadCurWorkspace.toString();- return Dispatch.asyncRequest(request)- .then((bytesResult) => bytesResult.fold(- (okBytes) => left(Workspace.fromBuffer(okBytes)),- (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),- ));- }+ return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(+ (okBytes) => left(Workspace.fromBuffer(okBytes)),+ (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),+ ));+ }}class WorkspaceEventReadWorkspaces {- QueryWorkspaceRequest request;- WorkspaceEventReadWorkspaces(this.request);+ QueryWorkspaceRequest request;+ WorkspaceEventReadWorkspaces(this.request);- Future<Either<RepeatedWorkspace, WorkspaceError>> send() {+ Future<Either<RepeatedWorkspace, WorkspaceError>> send() {final request = FFIRequest.create()- ..event = WorkspaceEvent.ReadWorkspaces.toString()- ..payload = requestToBytes(this.request);+ ..event = WorkspaceEvent.ReadWorkspaces.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (okBytes) => left(RepeatedWorkspace.fromBuffer(okBytes)),- (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),- ));- }+ (okBytes) => left(RepeatedWorkspace.fromBuffer(okBytes)),+ (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),+ ));+ }}class WorkspaceEventDeleteWorkspace {- DeleteWorkspaceRequest request;- WorkspaceEventDeleteWorkspace(this.request);+ DeleteWorkspaceRequest request;+ WorkspaceEventDeleteWorkspace(this.request);- Future<Either<Unit, WorkspaceError>> send() {+ Future<Either<Unit, WorkspaceError>> send() {final request = FFIRequest.create()- ..event = WorkspaceEvent.DeleteWorkspace.toString()- ..payload = requestToBytes(this.request);+ ..event = WorkspaceEvent.DeleteWorkspace.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (bytes) => left(unit),- (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),- ));- }+ (bytes) => left(unit),+ (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),+ ));+ }}class WorkspaceEventOpenWorkspace {- QueryWorkspaceRequest request;- WorkspaceEventOpenWorkspace(this.request);+ QueryWorkspaceRequest request;+ WorkspaceEventOpenWorkspace(this.request);- Future<Either<Workspace, WorkspaceError>> send() {+ Future<Either<Workspace, WorkspaceError>> send() {final request = FFIRequest.create()- ..event = WorkspaceEvent.OpenWorkspace.toString()- ..payload = requestToBytes(this.request);+ ..event = WorkspaceEvent.OpenWorkspace.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (okBytes) => left(Workspace.fromBuffer(okBytes)),- (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),- ));- }+ (okBytes) => left(Workspace.fromBuffer(okBytes)),+ (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),+ ));+ }}class WorkspaceEventCreateApp {- CreateAppRequest request;- WorkspaceEventCreateApp(this.request);+ CreateAppRequest request;+ WorkspaceEventCreateApp(this.request);- Future<Either<App, WorkspaceError>> send() {+ Future<Either<App, WorkspaceError>> send() {final request = FFIRequest.create()- ..event = WorkspaceEvent.CreateApp.toString()- ..payload = requestToBytes(this.request);+ ..event = WorkspaceEvent.CreateApp.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (okBytes) => left(App.fromBuffer(okBytes)),- (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),- ));- }+ (okBytes) => left(App.fromBuffer(okBytes)),+ (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),+ ));+ }}class WorkspaceEventDeleteApp {- DeleteAppRequest request;- WorkspaceEventDeleteApp(this.request);+ DeleteAppRequest request;+ WorkspaceEventDeleteApp(this.request);- Future<Either<Unit, WorkspaceError>> send() {+ Future<Either<Unit, WorkspaceError>> send() {final request = FFIRequest.create()- ..event = WorkspaceEvent.DeleteApp.toString()- ..payload = requestToBytes(this.request);+ ..event = WorkspaceEvent.DeleteApp.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (bytes) => left(unit),- (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),- ));- }+ (bytes) => left(unit),+ (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),+ ));+ }}class WorkspaceEventReadApp {- QueryAppRequest request;- WorkspaceEventReadApp(this.request);+ QueryAppRequest request;+ WorkspaceEventReadApp(this.request);- Future<Either<App, WorkspaceError>> send() {+ Future<Either<App, WorkspaceError>> send() {final request = FFIRequest.create()- ..event = WorkspaceEvent.ReadApp.toString()- ..payload = requestToBytes(this.request);+ ..event = WorkspaceEvent.ReadApp.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (okBytes) => left(App.fromBuffer(okBytes)),- (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),- ));- }+ (okBytes) => left(App.fromBuffer(okBytes)),+ (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),+ ));+ }}class WorkspaceEventUpdateApp {- UpdateAppRequest request;- WorkspaceEventUpdateApp(this.request);+ UpdateAppRequest request;+ WorkspaceEventUpdateApp(this.request);- Future<Either<Unit, WorkspaceError>> send() {+ Future<Either<Unit, WorkspaceError>> send() {final request = FFIRequest.create()- ..event = WorkspaceEvent.UpdateApp.toString()- ..payload = requestToBytes(this.request);+ ..event = WorkspaceEvent.UpdateApp.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (bytes) => left(unit),- (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),- ));- }+ (bytes) => left(unit),+ (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),+ ));+ }}class WorkspaceEventCreateView {- CreateViewRequest request;- WorkspaceEventCreateView(this.request);+ CreateViewRequest request;+ WorkspaceEventCreateView(this.request);- Future<Either<View, WorkspaceError>> send() {+ Future<Either<View, WorkspaceError>> send() {final request = FFIRequest.create()- ..event = WorkspaceEvent.CreateView.toString()- ..payload = requestToBytes(this.request);+ ..event = WorkspaceEvent.CreateView.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (okBytes) => left(View.fromBuffer(okBytes)),- (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),- ));- }+ (okBytes) => left(View.fromBuffer(okBytes)),+ (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),+ ));+ }}class WorkspaceEventReadView {- QueryViewRequest request;- WorkspaceEventReadView(this.request);+ QueryViewRequest request;+ WorkspaceEventReadView(this.request);- Future<Either<View, WorkspaceError>> send() {+ Future<Either<View, WorkspaceError>> send() {final request = FFIRequest.create()- ..event = WorkspaceEvent.ReadView.toString()- ..payload = requestToBytes(this.request);+ ..event = WorkspaceEvent.ReadView.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (okBytes) => left(View.fromBuffer(okBytes)),- (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),- ));- }+ (okBytes) => left(View.fromBuffer(okBytes)),+ (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),+ ));+ }}class WorkspaceEventUpdateView {- UpdateViewRequest request;- WorkspaceEventUpdateView(this.request);+ UpdateViewRequest request;+ WorkspaceEventUpdateView(this.request);- Future<Either<Unit, WorkspaceError>> send() {+ Future<Either<Unit, WorkspaceError>> send() {final request = FFIRequest.create()- ..event = WorkspaceEvent.UpdateView.toString()- ..payload = requestToBytes(this.request);+ ..event = WorkspaceEvent.UpdateView.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (bytes) => left(unit),- (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),- ));- }+ (bytes) => left(unit),+ (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),+ ));+ }}class WorkspaceEventDeleteView {- DeleteViewRequest request;- WorkspaceEventDeleteView(this.request);+ DeleteViewRequest request;+ WorkspaceEventDeleteView(this.request);- Future<Either<Unit, WorkspaceError>> send() {+ Future<Either<Unit, WorkspaceError>> send() {final request = FFIRequest.create()- ..event = WorkspaceEvent.DeleteView.toString()- ..payload = requestToBytes(this.request);+ ..event = WorkspaceEvent.DeleteView.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (bytes) => left(unit),- (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),- ));- }+ (bytes) => left(unit),+ (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),+ ));+ }}class EditorEventCreateDoc {- CreateDocRequest request;- EditorEventCreateDoc(this.request);+ CreateDocRequest request;+ EditorEventCreateDoc(this.request);- Future<Either<DocInfo, DocError>> send() {+ Future<Either<DocInfo, DocError>> send() {final request = FFIRequest.create()- ..event = EditorEvent.CreateDoc.toString()- ..payload = requestToBytes(this.request);+ ..event = EditorEvent.CreateDoc.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (okBytes) => left(DocInfo.fromBuffer(okBytes)),- (errBytes) => right(DocError.fromBuffer(errBytes)),- ));- }+ (okBytes) => left(DocInfo.fromBuffer(okBytes)),+ (errBytes) => right(DocError.fromBuffer(errBytes)),+ ));+ }}class EditorEventUpdateDoc {- UpdateDocRequest request;- EditorEventUpdateDoc(this.request);+ UpdateDocRequest request;+ EditorEventUpdateDoc(this.request);- Future<Either<Unit, DocError>> send() {+ Future<Either<Unit, DocError>> send() {final request = FFIRequest.create()- ..event = EditorEvent.UpdateDoc.toString()- ..payload = requestToBytes(this.request);+ ..event = EditorEvent.UpdateDoc.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (bytes) => left(unit),- (errBytes) => right(DocError.fromBuffer(errBytes)),- ));- }+ (bytes) => left(unit),+ (errBytes) => right(DocError.fromBuffer(errBytes)),+ ));+ }}class EditorEventReadDocInfo {- QueryDocRequest request;- EditorEventReadDocInfo(this.request);+ QueryDocRequest request;+ EditorEventReadDocInfo(this.request);- Future<Either<DocInfo, DocError>> send() {+ Future<Either<DocInfo, DocError>> send() {final request = FFIRequest.create()- ..event = EditorEvent.ReadDocInfo.toString()- ..payload = requestToBytes(this.request);+ ..event = EditorEvent.ReadDocInfo.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (okBytes) => left(DocInfo.fromBuffer(okBytes)),- (errBytes) => right(DocError.fromBuffer(errBytes)),- ));- }+ (okBytes) => left(DocInfo.fromBuffer(okBytes)),+ (errBytes) => right(DocError.fromBuffer(errBytes)),+ ));+ }}class EditorEventReadDocData {- QueryDocDataRequest request;- EditorEventReadDocData(this.request);+ QueryDocDataRequest request;+ EditorEventReadDocData(this.request);- Future<Either<DocData, DocError>> send() {+ Future<Either<DocData, DocError>> send() {final request = FFIRequest.create()- ..event = EditorEvent.ReadDocData.toString()- ..payload = requestToBytes(this.request);+ ..event = EditorEvent.ReadDocData.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (okBytes) => left(DocData.fromBuffer(okBytes)),- (errBytes) => right(DocError.fromBuffer(errBytes)),- ));- }+ (okBytes) => left(DocData.fromBuffer(okBytes)),+ (errBytes) => right(DocError.fromBuffer(errBytes)),+ ));+ }}-class UserEventGetStatus {- UserEventGetStatus();+class UserEventGetUserProfile {+ UserEventGetUserProfile();- Future<Either<UserDetail, UserError>> send() {- final request = FFIRequest.create()- ..event = UserEvent.GetUserProfile.toString();+ Future<Either<UserProfile, UserError>> send() {+ final request = FFIRequest.create()+ ..event = UserEvent.GetUserProfile.toString();- return Dispatch.asyncRequest(request)- .then((bytesResult) => bytesResult.fold(- (okBytes) => left(UserDetail.fromBuffer(okBytes)),- (errBytes) => right(UserError.fromBuffer(errBytes)),- ));- }+ return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(+ (okBytes) => left(UserProfile.fromBuffer(okBytes)),+ (errBytes) => right(UserError.fromBuffer(errBytes)),+ ));+ }}class UserEventSignIn {- SignInRequest request;- UserEventSignIn(this.request);+ SignInRequest request;+ UserEventSignIn(this.request);- Future<Either<UserDetail, UserError>> send() {+ Future<Either<UserProfile, UserError>> send() {final request = FFIRequest.create()- ..event = UserEvent.SignIn.toString()- ..payload = requestToBytes(this.request);+ ..event = UserEvent.SignIn.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (okBytes) => left(UserDetail.fromBuffer(okBytes)),- (errBytes) => right(UserError.fromBuffer(errBytes)),- ));- }+ (okBytes) => left(UserProfile.fromBuffer(okBytes)),+ (errBytes) => right(UserError.fromBuffer(errBytes)),+ ));+ }}class UserEventSignUp {- SignUpRequest request;- UserEventSignUp(this.request);+ SignUpRequest request;+ UserEventSignUp(this.request);- Future<Either<UserDetail, UserError>> send() {+ Future<Either<UserProfile, UserError>> send() {final request = FFIRequest.create()- ..event = UserEvent.SignUp.toString()- ..payload = requestToBytes(this.request);+ ..event = UserEvent.SignUp.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (okBytes) => left(UserDetail.fromBuffer(okBytes)),- (errBytes) => right(UserError.fromBuffer(errBytes)),- ));- }+ (okBytes) => left(UserProfile.fromBuffer(okBytes)),+ (errBytes) => right(UserError.fromBuffer(errBytes)),+ ));+ }}class UserEventSignOut {- UserEventSignOut();+ UserEventSignOut();- Future<Either<Unit, UserError>> send() {- final request = FFIRequest.create()..event = UserEvent.SignOut.toString();+ Future<Either<Unit, UserError>> send() {+ final request = FFIRequest.create()+ ..event = UserEvent.SignOut.toString();- return Dispatch.asyncRequest(request)- .then((bytesResult) => bytesResult.fold(- (bytes) => left(unit),- (errBytes) => right(UserError.fromBuffer(errBytes)),- ));- }+ return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(+ (bytes) => left(unit),+ (errBytes) => right(UserError.fromBuffer(errBytes)),+ ));+ }}class UserEventUpdateUser {- UpdateUserRequest request;- UserEventUpdateUser(this.request);+ UpdateUserRequest request;+ UserEventUpdateUser(this.request);- Future<Either<Unit, UserError>> send() {+ Future<Either<Unit, UserError>> send() {final request = FFIRequest.create()- ..event = UserEvent.UpdateUser.toString()- ..payload = requestToBytes(this.request);+ ..event = UserEvent.UpdateUser.toString()+ ..payload = requestToBytes(this.request);return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(- (bytes) => left(unit),- (errBytes) => right(UserError.fromBuffer(errBytes)),- ));- }+ (bytes) => left(unit),+ (errBytes) => right(UserError.fromBuffer(errBytes)),+ ));+ }}+diff --git a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/protobuf.dart b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/protobuf.dartindex ff0968c550..560ef1eb13 100644--- a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/protobuf.dart+++ b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/protobuf.dart@@ -1,6 +1,6 @@// Auto-generated, do not editexport './user_table.pb.dart';export './errors.pb.dart';-export './user_detail.pb.dart';+export './user_profile.pb.dart';export './event.pb.dart';export './auth.pb.dart';diff --git a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_detail.pb.dart b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_profile.pb.dartsimilarity index 92%rename from app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_detail.pb.dartrename to app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_profile.pb.dartindex c3c86bf668..8c85051e4d 100644--- a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_detail.pb.dart+++ b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_profile.pb.dart@@ -1,6 +1,6 @@///// Generated code. Do not modify.-// source: user_detail.proto+// source: user_profile.proto//// @dart = 2.12// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields@@ -9,7 +9,7 @@ import 'dart:core' as $core;import 'package:protobuf/protobuf.dart' as $pb;-export 'user_detail.pbenum.dart';+export 'user_profile.pbenum.dart';class UserToken extends $pb.GeneratedMessage {static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'UserToken', createEmptyInstance: create)@@ -58,16 +58,16 @@ class UserToken extends $pb.GeneratedMessage {void clearToken() => clearField(1);}-class UserDetail extends $pb.GeneratedMessage {- static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'UserDetail', createEmptyInstance: create)+class UserProfile extends $pb.GeneratedMessage {+ static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'UserProfile', createEmptyInstance: create)..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id')..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'email')..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')..hasRequiredFields = false;- UserDetail._() : super();- factory UserDetail({+ UserProfile._() : super();+ factory UserProfile({$core.String? id,$core.String? email,$core.String? name,@@ -84,26 +84,26 @@ class UserDetail extends $pb.GeneratedMessage {}return _result;}- factory UserDetail.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);- factory UserDetail.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);+ factory UserProfile.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);+ factory UserProfile.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);@$core.Deprecated('Using this can add significant overhead to your binary. ''Use [GeneratedMessageGenericExtensions.deepCopy] instead. ''Will be removed in next major version')- UserDetail clone() => UserDetail()..mergeFromMessage(this);+ UserProfile clone() => UserProfile()..mergeFromMessage(this);@$core.Deprecated('Using this can add significant overhead to your binary. ''Use [GeneratedMessageGenericExtensions.rebuild] instead. ''Will be removed in next major version')- UserDetail copyWith(void Function(UserDetail) updates) => super.copyWith((message) => updates(message as UserDetail)) as UserDetail; // ignore: deprecated_member_use+ UserProfile copyWith(void Function(UserProfile) updates) => super.copyWith((message) => updates(message as UserProfile)) as UserProfile; // ignore: deprecated_member_use$pb.BuilderInfo get info_ => _i;@$core.pragma('dart2js:noInline')- static UserDetail create() => UserDetail._();- UserDetail createEmptyInstance() => create();- static $pb.PbList<UserDetail> createRepeated() => $pb.PbList<UserDetail>();+ static UserProfile create() => UserProfile._();+ UserProfile createEmptyInstance() => create();+ static $pb.PbList<UserProfile> createRepeated() => $pb.PbList<UserProfile>();@$core.pragma('dart2js:noInline')- static UserDetail getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<UserDetail>(create);- static UserDetail? _defaultInstance;+ static UserProfile getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<UserProfile>(create);+ static UserProfile? _defaultInstance;@$pb.TagNumber(1)$core.String get id => $_getSZ(0);diff --git a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_detail.pbenum.dart b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_profile.pbenum.dartsimilarity index 97%rename from app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_detail.pbenum.dartrename to app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_profile.pbenum.dartindex b7fdb7eb7f..5859c59f22 100644--- a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_detail.pbenum.dart+++ b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_profile.pbenum.dart@@ -1,6 +1,6 @@///// Generated code. Do not modify.-// source: user_detail.proto+// source: user_profile.proto//// @dart = 2.12// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fieldsdiff --git a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_detail.pbjson.dart b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_profile.pbjson.dartsimilarity index 89%rename from app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_detail.pbjson.dartrename to app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_profile.pbjson.dartindex 022d9ec958..53eab06113 100644--- a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_detail.pbjson.dart+++ b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_profile.pbjson.dart@@ -1,6 +1,6 @@///// Generated code. Do not modify.-// source: user_detail.proto+// source: user_profile.proto//// @dart = 2.12// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package@@ -30,9 +30,9 @@ const UserToken$json = const {/// Descriptor for `UserToken`. Decode as a `google.protobuf.DescriptorProto`.final $typed_data.Uint8List userTokenDescriptor = $convert.base64Decode('CglVc2VyVG9rZW4SFAoFdG9rZW4YASABKAlSBXRva2Vu');-@$core.Deprecated('Use userDetailDescriptor instead')-const UserDetail$json = const {- '1': 'UserDetail',+@$core.Deprecated('Use userProfileDescriptor instead')+const UserProfile$json = const {+ '1': 'UserProfile','2': const [const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},const {'1': 'email', '3': 2, '4': 1, '5': 9, '10': 'email'},@@ -40,8 +40,8 @@ const UserDetail$json = const {],};-/// Descriptor for `UserDetail`. Decode as a `google.protobuf.DescriptorProto`.-final $typed_data.Uint8List userDetailDescriptor = $convert.base64Decode('CgpVc2VyRGV0YWlsEg4KAmlkGAEgASgJUgJpZBIUCgVlbWFpbBgCIAEoCVIFZW1haWwSEgoEbmFtZRgDIAEoCVIEbmFtZQ==');+/// Descriptor for `UserProfile`. Decode as a `google.protobuf.DescriptorProto`.+final $typed_data.Uint8List userProfileDescriptor = $convert.base64Decode('CgtVc2VyUHJvZmlsZRIOCgJpZBgBIAEoCVICaWQSFAoFZW1haWwYAiABKAlSBWVtYWlsEhIKBG5hbWUYAyABKAlSBG5hbWU=');@$core.Deprecated('Use updateUserRequestDescriptor instead')const UpdateUserRequest$json = const {'1': 'UpdateUserRequest',diff --git a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_detail.pbserver.dart b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_profile.pbserver.dartsimilarity index 83%rename from app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_detail.pbserver.dartrename to app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_profile.pbserver.dartindex 04131fb8de..20445601d6 100644--- a/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_detail.pbserver.dart+++ b/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-user/user_profile.pbserver.dart@@ -1,9 +1,9 @@///// Generated code. Do not modify.-// source: user_detail.proto+// source: user_profile.proto//// @dart = 2.12// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package-export 'user_detail.pb.dart';+export 'user_profile.pb.dart';diff --git a/backend/src/application.rs b/backend/src/application.rsindex e07fe9dc09..d28fe311ee 100644--- a/backend/src/application.rs+++ b/backend/src/application.rs@@ -85,8 +85,8 @@ fn user_scope() -> Scope {.route(web::delete().to(user::sign_out_handler))).service(web::resource("/user")- .route(web::patch().to(user::set_user_detail_handler))- .route(web::get().to(user::get_user_detail_handler))+ .route(web::patch().to(user::set_user_profile_handler))+ .route(web::get().to(user::get_user_profile_handler))).service(web::resource("/register").route(web::post().to(user::register_handler))diff --git a/backend/src/user_service/auth.rs b/backend/src/user_service/auth.rsindex e9d5f45514..d9a5e64556 100644--- a/backend/src/user_service/auth.rs+++ b/backend/src/user_service/auth.rs@@ -21,7 +21,7 @@ use flowy_user::{SignUpParams,SignUpResponse,UpdateUserParams,- UserDetail,+ UserProfile,},};use sqlx::{PgPool, Postgres};@@ -99,7 +99,7 @@ pub async fn register_user(FlowyResponse::success().pb(response_data)}-pub(crate) async fn get_user_details(+pub(crate) async fn get_user_profile(pool: &PgPool,logged_user: LoggedUser,) -> Result<FlowyResponse, ServerError> {@@ -124,14 +124,14 @@ pub(crate) async fn get_user_details(// update the user active timelet _ = AUTHORIZED_USERS.store_auth(logged_user, true)?;- let mut user_detail = UserDetail::default();- user_detail.set_id(user_table.id.to_string());- user_detail.set_email(user_table.email);- user_detail.set_name(user_table.name);- FlowyResponse::success().pb(user_detail)+ let mut user_profile = UserProfile::default();+ user_profile.set_id(user_table.id.to_string());+ user_profile.set_email(user_table.email);+ user_profile.set_name(user_table.name);+ FlowyResponse::success().pb(user_profile)}-pub(crate) async fn set_user_detail(+pub(crate) async fn set_user_profile(pool: &PgPool,logged_user: LoggedUser,params: UpdateUserParams,diff --git a/backend/src/user_service/router.rs b/backend/src/user_service/router.rsindex 63f2f5f98d..ba29419c22 100644--- a/backend/src/user_service/router.rs+++ b/backend/src/user_service/router.rs@@ -6,9 +6,9 @@ use actix_web::{};use crate::user_service::{- get_user_details,+ get_user_profile,register_user,- set_user_detail,+ set_user_profile,sign_in,sign_out,LoggedUser,@@ -40,21 +40,21 @@ pub async fn sign_out_handler(Ok(response.into())}-pub async fn get_user_detail_handler(+pub async fn get_user_profile_handler(logged_user: LoggedUser,pool: Data<PgPool>,) -> Result<HttpResponse, ServerError> {- let response = get_user_details(pool.get_ref(), logged_user).await?;+ let response = get_user_profile(pool.get_ref(), logged_user).await?;Ok(response.into())}-pub async fn set_user_detail_handler(+pub async fn set_user_profile_handler(logged_user: LoggedUser,pool: Data<PgPool>,payload: Payload,) -> Result<HttpResponse, ServerError> {let params: UpdateUserParams = parse_from_payload(payload).await?;- let response = set_user_detail(pool.get_ref(), logged_user, params).await?;+ let response = set_user_profile(pool.get_ref(), logged_user, params).await?;Ok(response.into())}diff --git a/backend/tests/api/auth.rs b/backend/tests/api/auth.rsindex 8bdfd7a8ff..5e9da88ce6 100644--- a/backend/tests/api/auth.rs+++ b/backend/tests/api/auth.rs@@ -56,14 +56,14 @@ async fn user_sign_out() {app.sign_out(&token).await;// user_detail will be empty because use was sign out.- app.get_user_detail(&token).await;+ app.get_user_profile(&token).await;}#[actix_rt::test]async fn user_get_detail() {let app = spawn_app().await;let sign_up_resp = sign_up_user(&app).await;- log::info!("{:?}", app.get_user_detail(&sign_up_resp.token).await);+ log::info!("{:?}", app.get_user_profile(&sign_up_resp.token).await);}#[actix_rt::test]@@ -74,7 +74,7 @@ async fn user_update_password() {let sign_up_resp = register_user(&app, email, password).await;let params = UpdateUserParams::new(&sign_up_resp.user_id).password("Hello123!");- app.update_user_detail(&sign_up_resp.token, params)+ app.update_user_profile(&sign_up_resp.token, params).await.unwrap();@@ -97,11 +97,11 @@ async fn user_update_name() {let sign_up_resp = sign_up_user(&app).await;let name = "tom".to_string();let params = UpdateUserParams::new(&sign_up_resp.user_id).name(&name);- app.update_user_detail(&sign_up_resp.token, params)+ app.update_user_profile(&sign_up_resp.token, params).await.unwrap();- let user = app.get_user_detail(&sign_up_resp.token).await;+ let user = app.get_user_profile(&sign_up_resp.token).await;assert_eq!(user.name, name);}@@ -111,11 +111,11 @@ async fn user_update_email() {let sign_up_resp = sign_up_user(&app).await;let email = "[email protected]".to_string();let params = UpdateUserParams::new(&sign_up_resp.user_id).email(&email);- app.update_user_detail(&sign_up_resp.token, params)+ app.update_user_profile(&sign_up_resp.token, params).await.unwrap();- let user = app.get_user_detail(&sign_up_resp.token).await;+ let user = app.get_user_profile(&sign_up_resp.token).await;assert_eq!(user.email, email);}diff --git a/backend/tests/api/helper.rs b/backend/tests/api/helper.rsindex 1822944d28..e91958347b 100644--- a/backend/tests/api/helper.rs+++ b/backend/tests/api/helper.rs@@ -31,19 +31,19 @@ impl TestApp {let _ = user_sign_out_request(token, &url).await.unwrap();}- pub async fn get_user_detail(&self, token: &str) -> UserDetail {+ pub async fn get_user_profile(&self, token: &str) -> UserProfile {let url = format!("{}/api/user", self.address);- let user_detail = get_user_detail_request(token, &url).await.unwrap();- user_detail+ let user_profile = get_user_profile_request(token, &url).await.unwrap();+ user_profile}- pub async fn update_user_detail(+ pub async fn update_user_profile(&self,token: &str,params: UpdateUserParams,) -> Result<(), UserError> {let url = format!("{}/api/user", self.address);- update_user_detail_request(token, params, &url).await+ update_user_profile_request(token, params, &url).await}pub async fn create_workspace(&self, params: CreateWorkspaceParams, token: &str) -> Workspace {diff --git a/rust-lib/flowy-derive/src/derive_cache/derive_cache.rs b/rust-lib/flowy-derive/src/derive_cache/derive_cache.rsindex c2e790c7d1..ffb42396a9 100644--- a/rust-lib/flowy-derive/src/derive_cache/derive_cache.rs+++ b/rust-lib/flowy-derive/src/derive_cache/derive_cache.rs@@ -66,7 +66,7 @@ pub fn category_from_str(type_str: &str) -> TypeCategory {| "SignUpParams"| "SignUpResponse"| "UserToken"- | "UserDetail"+ | "UserProfile"| "UpdateUserRequest"| "UpdateUserParams"| "UserError"diff --git a/rust-lib/flowy-test/src/builder.rs b/rust-lib/flowy-test/src/builder.rsindex 89388b7b1b..722876a40a 100644--- a/rust-lib/flowy-test/src/builder.rs+++ b/rust-lib/flowy-test/src/builder.rs@@ -1,5 +1,5 @@use flowy_dispatch::prelude::{EventDispatch, EventResponse, FromBytes, ModuleRequest, StatusCode, ToBytes};-use flowy_user::entities::UserDetail;+use flowy_user::entities::UserProfile;use std::{fmt::{Debug, Display},hash::Hash,@@ -26,13 +26,13 @@ impl WorkspaceTest {pub type UserTest = Builder<UserError>;impl UserTest {pub fn new(sdk: FlowyTestSDK) -> Self { Builder::test(TestContext::new(sdk)) }- pub fn user_detail(&self) -> &Option<UserDetail> { &self.user_detail }+ pub fn user_profile(&self) -> &Option<UserProfile> { &self.user_profile }}#[derive(Clone)]pub struct Builder<E> {context: TestContext,- user_detail: Option<UserDetail>,+ user_profile: Option<UserProfile>,err_phantom: PhantomData<E>,}@@ -43,7 +43,7 @@ wherepub(crate) fn test(context: TestContext) -> Self {Self {context,- user_detail: None,+ user_profile: None,err_phantom: PhantomData,}}diff --git a/rust-lib/flowy-test/src/helper.rs b/rust-lib/flowy-test/src/helper.rsindex 9d62999238..4d86bffdfa 100644--- a/rust-lib/flowy-test/src/helper.rs+++ b/rust-lib/flowy-test/src/helper.rs@@ -3,7 +3,7 @@ use flowy_dispatch::prelude::{EventDispatch, ModuleRequest, ToBytes};use flowy_infra::{kv::KV, uuid};use flowy_user::{- entities::{SignInRequest, SignUpRequest, UserDetail},+ entities::{SignInRequest, SignUpRequest, UserProfile},errors::{ErrorBuilder, ErrorCode, UserError},event::UserEvent::{SignIn, SignOut, SignUp},};@@ -76,7 +76,7 @@ pub(crate) fn create_default_workspace_if_need(dispatch: Arc<EventDispatch>, use}pub struct SignUpContext {- pub user_detail: UserDetail,+ pub user_profile: UserProfile,pub password: String,}@@ -91,17 +91,17 @@ pub fn sign_up(dispatch: Arc<EventDispatch>) -> SignUpContext {.unwrap();let request = ModuleRequest::new(SignUp).payload(payload);- let user_detail = EventDispatch::sync_send(dispatch.clone(), request)- .parse::<UserDetail, UserError>()+ let user_profile = EventDispatch::sync_send(dispatch.clone(), request)+ .parse::<UserProfile, UserError>().unwrap().unwrap();- let _ = create_default_workspace_if_need(dispatch.clone(), &user_detail.id);- SignUpContext { user_detail, password }+ let _ = create_default_workspace_if_need(dispatch.clone(), &user_profile.id);+ SignUpContext { user_profile, password }}#[allow(dead_code)]-fn sign_in(dispatch: Arc<EventDispatch>) -> UserDetail {+fn sign_in(dispatch: Arc<EventDispatch>) -> UserProfile {let payload = SignInRequest {email: login_email(),password: login_password(),@@ -110,12 +110,12 @@ fn sign_in(dispatch: Arc<EventDispatch>) -> UserDetail {.unwrap();let request = ModuleRequest::new(SignIn).payload(payload);- let user_detail = EventDispatch::sync_send(dispatch, request)- .parse::<UserDetail, UserError>()+ let user_profile = EventDispatch::sync_send(dispatch, request)+ .parse::<UserProfile, UserError>().unwrap().unwrap();- user_detail+ user_profile}#[allow(dead_code)]diff --git a/rust-lib/flowy-test/src/lib.rs b/rust-lib/flowy-test/src/lib.rsindex 23ceaab6b3..bbb59e8772 100644--- a/rust-lib/flowy-test/src/lib.rs+++ b/rust-lib/flowy-test/src/lib.rs@@ -3,7 +3,7 @@ mod helper;use crate::helper::*;use flowy_sdk::FlowySDK;-use flowy_user::entities::UserDetail;+use flowy_user::entities::UserProfile;pub mod prelude {pub use crate::{builder::*, helper::*, *};@@ -15,7 +15,7 @@ pub type FlowyTestSDK = FlowySDK;#[derive(Clone)]pub struct FlowyEnv {pub sdk: FlowyTestSDK,- pub user: UserDetail,+ pub user: UserProfile,pub password: String,}@@ -25,7 +25,7 @@ impl FlowyEnv {let result = sign_up(sdk.dispatch());let env = Self {sdk,- user: result.user_detail,+ user: result.user_profile,password: result.password,};envdiff --git a/rust-lib/flowy-user/src/entities/mod.rs b/rust-lib/flowy-user/src/entities/mod.rsindex fe3feb100e..dbedae4542 100644--- a/rust-lib/flowy-user/src/entities/mod.rs+++ b/rust-lib/flowy-user/src/entities/mod.rs@@ -1,6 +1,6 @@pub use auth::*;-pub use user_detail::*;+pub use user_profile::*;pub mod parser;pub mod auth;-mod user_detail;+mod user_profile;diff --git a/rust-lib/flowy-user/src/entities/user_detail.rs b/rust-lib/flowy-user/src/entities/user_profile.rssimilarity index 97%rename from rust-lib/flowy-user/src/entities/user_detail.rsrename to rust-lib/flowy-user/src/entities/user_profile.rsindex b0e76f4950..7d24e8e8d3 100644--- a/rust-lib/flowy-user/src/entities/user_detail.rs+++ b/rust-lib/flowy-user/src/entities/user_profile.rs@@ -18,7 +18,7 @@ impl std::default::Default for UserStatus {}#[derive(ProtoBuf, Default, Debug, PartialEq, Eq, Clone)]-pub struct UserDetail {+pub struct UserProfile {#[pb(index = 1)]pub id: String,@@ -36,9 +36,9 @@ use crate::{};use std::convert::TryInto;-impl std::convert::From<UserTable> for UserDetail {+impl std::convert::From<UserTable> for UserProfile {fn from(user: UserTable) -> Self {- UserDetail {+ UserProfile {id: user.id,email: user.email,name: user.name,diff --git a/rust-lib/flowy-user/src/event.rs b/rust-lib/flowy-user/src/event.rsindex f0ff2aafe7..76c9fe073c 100644--- a/rust-lib/flowy-user/src/event.rs+++ b/rust-lib/flowy-user/src/event.rs@@ -4,13 +4,13 @@ use strum_macros::Display;#[derive(Clone, Copy, PartialEq, Eq, Debug, Display, Hash, ProtoBuf_Enum, Flowy_Event)]#[event_err = "UserError"]pub enum UserEvent {- #[event(output = "UserDetail")]+ #[event(output = "UserProfile")]GetUserProfile = 0,- #[event(input = "SignInRequest", output = "UserDetail")]+ #[event(input = "SignInRequest", output = "UserProfile")]SignIn = 1,- #[event(input = "SignUpRequest", output = "UserDetail")]+ #[event(input = "SignUpRequest", output = "UserProfile")]SignUp = 2,#[event(passthrough)]diff --git a/rust-lib/flowy-user/src/handlers/auth_handler.rs b/rust-lib/flowy-user/src/handlers/auth_handler.rsindex 9c52be4d5e..164eb5a2bd 100644--- a/rust-lib/flowy-user/src/handlers/auth_handler.rs+++ b/rust-lib/flowy-user/src/handlers/auth_handler.rs@@ -4,10 +4,10 @@ use std::{convert::TryInto, sync::Arc};// tracing instrument 👉🏻 https://docs.rs/tracing/0.1.26/tracing/attr.instrument.html#[tracing::instrument(name = "sign_in", skip(data, session), fields(email = %data.email))]-pub async fn sign_in(data: Data<SignInRequest>, session: Unit<Arc<UserSession>>) -> DataResult<UserDetail, UserError> {+pub async fn sign_in(data: Data<SignInRequest>, session: Unit<Arc<UserSession>>) -> DataResult<UserProfile, UserError> {let params: SignInParams = data.into_inner().try_into()?;- let user_detail = session.sign_in(params).await?;- data_result(user_detail)+ let user_profile = session.sign_in(params).await?;+ data_result(user_profile)}#[tracing::instrument(@@ -18,9 +18,9 @@ pub async fn sign_in(data: Data<SignInRequest>, session: Unit<Arc<UserSession>>)name = %data.name,))]-pub async fn sign_up(data: Data<SignUpRequest>, session: Unit<Arc<UserSession>>) -> DataResult<UserDetail, UserError> {+pub async fn sign_up(data: Data<SignUpRequest>, session: Unit<Arc<UserSession>>) -> DataResult<UserProfile, UserError> {let params: SignUpParams = data.into_inner().try_into()?;- let user_detail = session.sign_up(params).await?;+ let user_profile = session.sign_up(params).await?;- data_result(user_detail)+ data_result(user_profile)}diff --git a/rust-lib/flowy-user/src/handlers/user_handler.rs b/rust-lib/flowy-user/src/handlers/user_handler.rsindex 5fd7141ff7..8e1ef10254 100644--- a/rust-lib/flowy-user/src/handlers/user_handler.rs+++ b/rust-lib/flowy-user/src/handlers/user_handler.rs@@ -4,9 +4,9 @@ use flowy_dispatch::prelude::*;use std::{convert::TryInto, sync::Arc};#[tracing::instrument(name = "get_user_status", skip(session))]-pub async fn user_profile_handler(session: Unit<Arc<UserSession>>) -> DataResult<UserDetail, UserError> {- let user_detail = session.user_detail().await?;- data_result(user_detail)+pub async fn user_profile_handler(session: Unit<Arc<UserSession>>) -> DataResult<UserProfile, UserError> {+ let user_profile = session.user_profile().await?;+ data_result(user_profile)}#[tracing::instrument(name = "sign_out", skip(session))]diff --git a/rust-lib/flowy-user/src/protobuf/model/mod.rs b/rust-lib/flowy-user/src/protobuf/model/mod.rsindex 6982043979..101da0e0ec 100644--- a/rust-lib/flowy-user/src/protobuf/model/mod.rs+++ b/rust-lib/flowy-user/src/protobuf/model/mod.rs@@ -6,8 +6,8 @@ pub use user_table::*;mod errors;pub use errors::*;-mod user_detail;-pub use user_detail::*;+mod user_profile;+pub use user_profile::*;mod event;pub use event::*;diff --git a/rust-lib/flowy-user/src/protobuf/model/user_detail.rs b/rust-lib/flowy-user/src/protobuf/model/user_profile.rssimilarity index 89%rename from rust-lib/flowy-user/src/protobuf/model/user_detail.rsrename to rust-lib/flowy-user/src/protobuf/model/user_profile.rsindex e6d3fc0bdb..aee8602938 100644--- a/rust-lib/flowy-user/src/protobuf/model/user_detail.rs+++ b/rust-lib/flowy-user/src/protobuf/model/user_profile.rs@@ -17,7 +17,7 @@#![allow(trivial_casts)]#![allow(unused_imports)]#![allow(unused_results)]-//! Generated file from `user_detail.proto`+//! Generated file from `user_profile.proto`/// Generated files are compatible only with the same version/// of protobuf runtime.@@ -183,7 +183,7 @@ impl ::protobuf::reflect::ProtobufValue for UserToken {}#[derive(PartialEq,Clone,Default)]-pub struct UserDetail {+pub struct UserProfile {// message fieldspub id: ::std::string::String,pub email: ::std::string::String,@@ -193,14 +193,14 @@ pub struct UserDetail {pub cached_size: ::protobuf::CachedSize,}-impl<'a> ::std::default::Default for &'a UserDetail {- fn default() -> &'a UserDetail {- <UserDetail as ::protobuf::Message>::default_instance()+impl<'a> ::std::default::Default for &'a UserProfile {+ fn default() -> &'a UserProfile {+ <UserProfile as ::protobuf::Message>::default_instance()}}-impl UserDetail {- pub fn new() -> UserDetail {+impl UserProfile {+ pub fn new() -> UserProfile {::std::default::Default::default()}@@ -283,7 +283,7 @@ impl UserDetail {}}-impl ::protobuf::Message for UserDetail {+impl ::protobuf::Message for UserProfile {fn is_initialized(&self) -> bool {true}@@ -367,8 +367,8 @@ impl ::protobuf::Message for UserDetail {Self::descriptor_static()}- fn new() -> UserDetail {- UserDetail::new()+ fn new() -> UserProfile {+ UserProfile::new()}fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {@@ -377,34 +377,34 @@ impl ::protobuf::Message for UserDetail {let mut fields = ::std::vec::Vec::new();fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>("id",- |m: &UserDetail| { &m.id },- |m: &mut UserDetail| { &mut m.id },+ |m: &UserProfile| { &m.id },+ |m: &mut UserProfile| { &mut m.id },));fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>("email",- |m: &UserDetail| { &m.email },- |m: &mut UserDetail| { &mut m.email },+ |m: &UserProfile| { &m.email },+ |m: &mut UserProfile| { &mut m.email },));fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>("name",- |m: &UserDetail| { &m.name },- |m: &mut UserDetail| { &mut m.name },+ |m: &UserProfile| { &m.name },+ |m: &mut UserProfile| { &mut m.name },));- ::protobuf::reflect::MessageDescriptor::new_pb_name::<UserDetail>(- "UserDetail",+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<UserProfile>(+ "UserProfile",fields,file_descriptor_proto())})}- fn default_instance() -> &'static UserDetail {- static instance: ::protobuf::rt::LazyV2<UserDetail> = ::protobuf::rt::LazyV2::INIT;- instance.get(UserDetail::new)+ fn default_instance() -> &'static UserProfile {+ static instance: ::protobuf::rt::LazyV2<UserProfile> = ::protobuf::rt::LazyV2::INIT;+ instance.get(UserProfile::new)}}-impl ::protobuf::Clear for UserDetail {+impl ::protobuf::Clear for UserProfile {fn clear(&mut self) {self.id.clear();self.email.clear();@@ -413,13 +413,13 @@ impl ::protobuf::Clear for UserDetail {}}-impl ::std::fmt::Debug for UserDetail {+impl ::std::fmt::Debug for UserProfile {fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {::protobuf::text_format::fmt(self, f)}}-impl ::protobuf::reflect::ProtobufValue for UserDetail {+impl ::protobuf::reflect::ProtobufValue for UserProfile {fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {::protobuf::reflect::ReflectValueRef::Message(self)}@@ -1285,10 +1285,10 @@ impl ::protobuf::reflect::ProtobufValue for UserStatus {}static file_descriptor_proto_data: &'static [u8] = b"\- \n\x11user_detail.proto\"!\n\tUserToken\x12\x14\n\x05token\x18\x01\x20\- \x01(\tR\x05token\"F\n\nUserDetail\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\- \x02id\x12\x14\n\x05email\x18\x02\x20\x01(\tR\x05email\x12\x12\n\x04name\- \x18\x03\x20\x01(\tR\x04name\"\xa1\x01\n\x11UpdateUserRequest\x12\x0e\n\+ \n\x12user_profile.proto\"!\n\tUserToken\x12\x14\n\x05token\x18\x01\x20\+ \x01(\tR\x05token\"G\n\x0bUserProfile\x12\x0e\n\x02id\x18\x01\x20\x01(\t\+ R\x02id\x12\x14\n\x05email\x18\x02\x20\x01(\tR\x05email\x12\x12\n\x04nam\+ e\x18\x03\x20\x01(\tR\x04name\"\xa1\x01\n\x11UpdateUserRequest\x12\x0e\n\\x02id\x18\x01\x20\x01(\tR\x02id\x12\x14\n\x04name\x18\x02\x20\x01(\tH\0\R\x04name\x12\x16\n\x05email\x18\x03\x20\x01(\tH\x01R\x05email\x12\x1c\n\\x08password\x18\x04\x20\x01(\tH\x02R\x08passwordB\r\n\x0bone_of_nameB\@@ -1298,60 +1298,60 @@ static file_descriptor_proto_data: &'static [u8] = b"\\x05email\x12\x1c\n\x08password\x18\x04\x20\x01(\tH\x02R\x08passwordB\r\\n\x0bone_of_nameB\x0e\n\x0cone_of_emailB\x11\n\x0fone_of_password*1\n\n\UserStatus\x12\x0b\n\x07Unknown\x10\0\x12\t\n\x05Login\x10\x01\x12\x0b\n\- \x07Expired\x10\x02J\xbb\x08\n\x06\x12\x04\0\0\x1a\x01\n\x08\n\x01\x0c\- \x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x04\x01\n\n\n\x03\x04\0\- \x01\x12\x03\x02\x08\x11\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x15\n\- \x0c\n\x05\x04\0\x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\- \x12\x03\x03\x0b\x10\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x13\x14\n\n\- \n\x02\x04\x01\x12\x04\x05\0\t\x01\n\n\n\x03\x04\x01\x01\x12\x03\x05\x08\- \x12\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x06\x04\x12\n\x0c\n\x05\x04\x01\- \x02\0\x05\x12\x03\x06\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x06\- \x0b\r\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x06\x10\x11\n\x0b\n\x04\x04\- \x01\x02\x01\x12\x03\x07\x04\x15\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\- \x07\x04\n\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x07\x0b\x10\n\x0c\n\- \x05\x04\x01\x02\x01\x03\x12\x03\x07\x13\x14\n\x0b\n\x04\x04\x01\x02\x02\- \x12\x03\x08\x04\x14\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03\x08\x04\n\n\- \x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\x08\x0b\x0f\n\x0c\n\x05\x04\x01\- \x02\x02\x03\x12\x03\x08\x12\x13\n\n\n\x02\x04\x02\x12\x04\n\0\x0f\x01\n\- \n\n\x03\x04\x02\x01\x12\x03\n\x08\x19\n\x0b\n\x04\x04\x02\x02\0\x12\x03\- \x0b\x04\x12\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x0b\x04\n\n\x0c\n\x05\- \x04\x02\x02\0\x01\x12\x03\x0b\x0b\r\n\x0c\n\x05\x04\x02\x02\0\x03\x12\- \x03\x0b\x10\x11\n\x0b\n\x04\x04\x02\x08\0\x12\x03\x0c\x04*\n\x0c\n\x05\- \x04\x02\x08\0\x01\x12\x03\x0c\n\x15\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\- \x0c\x18(\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03\x0c\x18\x1e\n\x0c\n\- \x05\x04\x02\x02\x01\x01\x12\x03\x0c\x1f#\n\x0c\n\x05\x04\x02\x02\x01\- \x03\x12\x03\x0c&'\n\x0b\n\x04\x04\x02\x08\x01\x12\x03\r\x04,\n\x0c\n\- \x05\x04\x02\x08\x01\x01\x12\x03\r\n\x16\n\x0b\n\x04\x04\x02\x02\x02\x12\- \x03\r\x19*\n\x0c\n\x05\x04\x02\x02\x02\x05\x12\x03\r\x19\x1f\n\x0c\n\- \x05\x04\x02\x02\x02\x01\x12\x03\r\x20%\n\x0c\n\x05\x04\x02\x02\x02\x03\- \x12\x03\r()\n\x0b\n\x04\x04\x02\x08\x02\x12\x03\x0e\x042\n\x0c\n\x05\- \x04\x02\x08\x02\x01\x12\x03\x0e\n\x19\n\x0b\n\x04\x04\x02\x02\x03\x12\- \x03\x0e\x1c0\n\x0c\n\x05\x04\x02\x02\x03\x05\x12\x03\x0e\x1c\"\n\x0c\n\- \x05\x04\x02\x02\x03\x01\x12\x03\x0e#+\n\x0c\n\x05\x04\x02\x02\x03\x03\- \x12\x03\x0e./\n\n\n\x02\x04\x03\x12\x04\x10\0\x15\x01\n\n\n\x03\x04\x03\- \x01\x12\x03\x10\x08\x18\n\x0b\n\x04\x04\x03\x02\0\x12\x03\x11\x04\x12\n\- \x0c\n\x05\x04\x03\x02\0\x05\x12\x03\x11\x04\n\n\x0c\n\x05\x04\x03\x02\0\- \x01\x12\x03\x11\x0b\r\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03\x11\x10\x11\- \n\x0b\n\x04\x04\x03\x08\0\x12\x03\x12\x04*\n\x0c\n\x05\x04\x03\x08\0\- \x01\x12\x03\x12\n\x15\n\x0b\n\x04\x04\x03\x02\x01\x12\x03\x12\x18(\n\- \x0c\n\x05\x04\x03\x02\x01\x05\x12\x03\x12\x18\x1e\n\x0c\n\x05\x04\x03\- \x02\x01\x01\x12\x03\x12\x1f#\n\x0c\n\x05\x04\x03\x02\x01\x03\x12\x03\- \x12&'\n\x0b\n\x04\x04\x03\x08\x01\x12\x03\x13\x04,\n\x0c\n\x05\x04\x03\- \x08\x01\x01\x12\x03\x13\n\x16\n\x0b\n\x04\x04\x03\x02\x02\x12\x03\x13\- \x19*\n\x0c\n\x05\x04\x03\x02\x02\x05\x12\x03\x13\x19\x1f\n\x0c\n\x05\- \x04\x03\x02\x02\x01\x12\x03\x13\x20%\n\x0c\n\x05\x04\x03\x02\x02\x03\- \x12\x03\x13()\n\x0b\n\x04\x04\x03\x08\x02\x12\x03\x14\x042\n\x0c\n\x05\- \x04\x03\x08\x02\x01\x12\x03\x14\n\x19\n\x0b\n\x04\x04\x03\x02\x03\x12\- \x03\x14\x1c0\n\x0c\n\x05\x04\x03\x02\x03\x05\x12\x03\x14\x1c\"\n\x0c\n\- \x05\x04\x03\x02\x03\x01\x12\x03\x14#+\n\x0c\n\x05\x04\x03\x02\x03\x03\- \x12\x03\x14./\n\n\n\x02\x05\0\x12\x04\x16\0\x1a\x01\n\n\n\x03\x05\0\x01\- \x12\x03\x16\x05\x0f\n\x0b\n\x04\x05\0\x02\0\x12\x03\x17\x04\x10\n\x0c\n\- \x05\x05\0\x02\0\x01\x12\x03\x17\x04\x0b\n\x0c\n\x05\x05\0\x02\0\x02\x12\- \x03\x17\x0e\x0f\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x18\x04\x0e\n\x0c\n\- \x05\x05\0\x02\x01\x01\x12\x03\x18\x04\t\n\x0c\n\x05\x05\0\x02\x01\x02\- \x12\x03\x18\x0c\r\n\x0b\n\x04\x05\0\x02\x02\x12\x03\x19\x04\x10\n\x0c\n\- \x05\x05\0\x02\x02\x01\x12\x03\x19\x04\x0b\n\x0c\n\x05\x05\0\x02\x02\x02\- \x12\x03\x19\x0e\x0fb\x06proto3\+ \x07Expired\x10\x02J\xbb\x08\n\x06\x12\x04\0\0\x19\x01\n\x08\n\x01\x0c\+ \x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x01\0\x03\x01\n\n\n\x03\x04\0\+ \x01\x12\x03\x01\x08\x11\n\x0b\n\x04\x04\0\x02\0\x12\x03\x02\x04\x15\n\+ \x0c\n\x05\x04\0\x02\0\x05\x12\x03\x02\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\+ \x12\x03\x02\x0b\x10\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x02\x13\x14\n\n\+ \n\x02\x04\x01\x12\x04\x04\0\x08\x01\n\n\n\x03\x04\x01\x01\x12\x03\x04\+ \x08\x13\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x05\x04\x12\n\x0c\n\x05\x04\+ \x01\x02\0\x05\x12\x03\x05\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\+ \x05\x0b\r\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x05\x10\x11\n\x0b\n\x04\+ \x04\x01\x02\x01\x12\x03\x06\x04\x15\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\+ \x03\x06\x04\n\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x06\x0b\x10\n\x0c\+ \n\x05\x04\x01\x02\x01\x03\x12\x03\x06\x13\x14\n\x0b\n\x04\x04\x01\x02\+ \x02\x12\x03\x07\x04\x14\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03\x07\x04\+ \n\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\x07\x0b\x0f\n\x0c\n\x05\x04\+ \x01\x02\x02\x03\x12\x03\x07\x12\x13\n\n\n\x02\x04\x02\x12\x04\t\0\x0e\+ \x01\n\n\n\x03\x04\x02\x01\x12\x03\t\x08\x19\n\x0b\n\x04\x04\x02\x02\0\+ \x12\x03\n\x04\x12\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\n\x04\n\n\x0c\n\+ \x05\x04\x02\x02\0\x01\x12\x03\n\x0b\r\n\x0c\n\x05\x04\x02\x02\0\x03\x12\+ \x03\n\x10\x11\n\x0b\n\x04\x04\x02\x08\0\x12\x03\x0b\x04*\n\x0c\n\x05\+ \x04\x02\x08\0\x01\x12\x03\x0b\n\x15\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\+ \x0b\x18(\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03\x0b\x18\x1e\n\x0c\n\+ \x05\x04\x02\x02\x01\x01\x12\x03\x0b\x1f#\n\x0c\n\x05\x04\x02\x02\x01\+ \x03\x12\x03\x0b&'\n\x0b\n\x04\x04\x02\x08\x01\x12\x03\x0c\x04,\n\x0c\n\+ \x05\x04\x02\x08\x01\x01\x12\x03\x0c\n\x16\n\x0b\n\x04\x04\x02\x02\x02\+ \x12\x03\x0c\x19*\n\x0c\n\x05\x04\x02\x02\x02\x05\x12\x03\x0c\x19\x1f\n\+ \x0c\n\x05\x04\x02\x02\x02\x01\x12\x03\x0c\x20%\n\x0c\n\x05\x04\x02\x02\+ \x02\x03\x12\x03\x0c()\n\x0b\n\x04\x04\x02\x08\x02\x12\x03\r\x042\n\x0c\+ \n\x05\x04\x02\x08\x02\x01\x12\x03\r\n\x19\n\x0b\n\x04\x04\x02\x02\x03\+ \x12\x03\r\x1c0\n\x0c\n\x05\x04\x02\x02\x03\x05\x12\x03\r\x1c\"\n\x0c\n\+ \x05\x04\x02\x02\x03\x01\x12\x03\r#+\n\x0c\n\x05\x04\x02\x02\x03\x03\x12\+ \x03\r./\n\n\n\x02\x04\x03\x12\x04\x0f\0\x14\x01\n\n\n\x03\x04\x03\x01\+ \x12\x03\x0f\x08\x18\n\x0b\n\x04\x04\x03\x02\0\x12\x03\x10\x04\x12\n\x0c\+ \n\x05\x04\x03\x02\0\x05\x12\x03\x10\x04\n\n\x0c\n\x05\x04\x03\x02\0\x01\+ \x12\x03\x10\x0b\r\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03\x10\x10\x11\n\+ \x0b\n\x04\x04\x03\x08\0\x12\x03\x11\x04*\n\x0c\n\x05\x04\x03\x08\0\x01\+ \x12\x03\x11\n\x15\n\x0b\n\x04\x04\x03\x02\x01\x12\x03\x11\x18(\n\x0c\n\+ \x05\x04\x03\x02\x01\x05\x12\x03\x11\x18\x1e\n\x0c\n\x05\x04\x03\x02\x01\+ \x01\x12\x03\x11\x1f#\n\x0c\n\x05\x04\x03\x02\x01\x03\x12\x03\x11&'\n\+ \x0b\n\x04\x04\x03\x08\x01\x12\x03\x12\x04,\n\x0c\n\x05\x04\x03\x08\x01\+ \x01\x12\x03\x12\n\x16\n\x0b\n\x04\x04\x03\x02\x02\x12\x03\x12\x19*\n\+ \x0c\n\x05\x04\x03\x02\x02\x05\x12\x03\x12\x19\x1f\n\x0c\n\x05\x04\x03\+ \x02\x02\x01\x12\x03\x12\x20%\n\x0c\n\x05\x04\x03\x02\x02\x03\x12\x03\+ \x12()\n\x0b\n\x04\x04\x03\x08\x02\x12\x03\x13\x042\n\x0c\n\x05\x04\x03\+ \x08\x02\x01\x12\x03\x13\n\x19\n\x0b\n\x04\x04\x03\x02\x03\x12\x03\x13\+ \x1c0\n\x0c\n\x05\x04\x03\x02\x03\x05\x12\x03\x13\x1c\"\n\x0c\n\x05\x04\+ \x03\x02\x03\x01\x12\x03\x13#+\n\x0c\n\x05\x04\x03\x02\x03\x03\x12\x03\+ \x13./\n\n\n\x02\x05\0\x12\x04\x15\0\x19\x01\n\n\n\x03\x05\0\x01\x12\x03\+ \x15\x05\x0f\n\x0b\n\x04\x05\0\x02\0\x12\x03\x16\x04\x10\n\x0c\n\x05\x05\+ \0\x02\0\x01\x12\x03\x16\x04\x0b\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\x16\+ \x0e\x0f\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x17\x04\x0e\n\x0c\n\x05\x05\0\+ \x02\x01\x01\x12\x03\x17\x04\t\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03\x17\+ \x0c\r\n\x0b\n\x04\x05\0\x02\x02\x12\x03\x18\x04\x10\n\x0c\n\x05\x05\0\+ \x02\x02\x01\x12\x03\x18\x04\x0b\n\x0c\n\x05\x05\0\x02\x02\x02\x12\x03\+ \x18\x0e\x0fb\x06proto3\";static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;diff --git a/rust-lib/flowy-user/src/protobuf/proto/user_detail.proto b/rust-lib/flowy-user/src/protobuf/proto/user_profile.protosimilarity index 96%rename from rust-lib/flowy-user/src/protobuf/proto/user_detail.protorename to rust-lib/flowy-user/src/protobuf/proto/user_profile.protoindex f0e5f7dff9..d9127433dc 100644--- a/rust-lib/flowy-user/src/protobuf/proto/user_detail.proto+++ b/rust-lib/flowy-user/src/protobuf/proto/user_profile.proto@@ -1,9 +1,8 @@syntax = "proto3";-message UserToken {string token = 1;}-message UserDetail {+message UserProfile {string id = 1;string email = 2;string name = 3;diff --git a/rust-lib/flowy-user/src/services/server/mod.rs b/rust-lib/flowy-user/src/services/server/mod.rsindex f3e8ff72b5..d35dd41a2a 100644--- a/rust-lib/flowy-user/src/services/server/mod.rs+++ b/rust-lib/flowy-user/src/services/server/mod.rs@@ -6,7 +6,7 @@ pub use server_api_mock::*;use std::sync::Arc;pub(crate) type Server = Arc<dyn UserServerAPI + Send + Sync>;use crate::{- entities::{SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserParams, UserDetail},+ entities::{SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserParams, UserProfile},errors::UserError,};use flowy_infra::future::ResultFuture;@@ -16,7 +16,7 @@ pub trait UserServerAPI {fn sign_in(&self, params: SignInParams) -> ResultFuture<SignInResponse, UserError>;fn sign_out(&self, token: &str) -> ResultFuture<(), UserError>;fn update_user(&self, token: &str, params: UpdateUserParams) -> ResultFuture<(), UserError>;- fn get_user_detail(&self, token: &str) -> ResultFuture<UserDetail, UserError>;+ fn get_user(&self, token: &str) -> ResultFuture<UserProfile, UserError>;}pub(crate) fn construct_user_server() -> Arc<dyn UserServerAPI + Send + Sync> {diff --git a/rust-lib/flowy-user/src/services/server/server_api.rs b/rust-lib/flowy-user/src/services/server/server_api.rsindex 4fa39d1faa..117d8ce13e 100644--- a/rust-lib/flowy-user/src/services/server/server_api.rs+++ b/rust-lib/flowy-user/src/services/server/server_api.rs@@ -1,5 +1,5 @@use crate::{- entities::{SignInParams, SignInResponse, SignUpParams, SignUpResponse, UserDetail},+ entities::{SignInParams, SignInResponse, SignUpParams, SignUpResponse, UserProfile},errors::UserError,};@@ -31,12 +31,12 @@ impl UserServerAPI for UserServer {fn update_user(&self, token: &str, params: UpdateUserParams) -> ResultFuture<(), UserError> {let token = token.to_owned();- ResultFuture::new(async move { update_user_detail_request(&token, params, USER_PROFILE_URL.as_ref()).await })+ ResultFuture::new(async move { update_user_profile_request(&token, params, USER_PROFILE_URL.as_ref()).await })}- fn get_user_detail(&self, token: &str) -> ResultFuture<UserDetail, UserError> {+ fn get_user(&self, token: &str) -> ResultFuture<UserProfile, UserError> {let token = token.to_owned();- ResultFuture::new(async move { get_user_detail_request(&token, USER_PROFILE_URL.as_ref()).await })+ ResultFuture::new(async move { get_user_profile_request(&token, USER_PROFILE_URL.as_ref()).await })}}@@ -68,17 +68,17 @@ pub async fn user_sign_out_request(token: &str, url: &str) -> Result<(), UserErrOk(())}-pub async fn get_user_detail_request(token: &str, url: &str) -> Result<UserDetail, UserError> {- let user_detail = HttpRequestBuilder::get(&url.to_owned())+pub async fn get_user_profile_request(token: &str, url: &str) -> Result<UserProfile, UserError> {+ let user_profile = HttpRequestBuilder::get(&url.to_owned()).header(HEADER_TOKEN, token).send().await?.response().await?;- Ok(user_detail)+ Ok(user_profile)}-pub async fn update_user_detail_request(token: &str, params: UpdateUserParams, url: &str) -> Result<(), UserError> {+pub async fn update_user_profile_request(token: &str, params: UpdateUserParams, url: &str) -> Result<(), UserError> {let _ = HttpRequestBuilder::patch(&url.to_owned()).header(HEADER_TOKEN, token).protobuf(params)?diff --git a/rust-lib/flowy-user/src/services/server/server_api_mock.rs b/rust-lib/flowy-user/src/services/server/server_api_mock.rsindex aca5fe07ab..505f5dabb3 100644--- a/rust-lib/flowy-user/src/services/server/server_api_mock.rs+++ b/rust-lib/flowy-user/src/services/server/server_api_mock.rs@@ -1,5 +1,5 @@use crate::{- entities::{SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserParams, UserDetail},+ entities::{SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserParams, UserProfile},errors::{ErrorBuilder, ErrorCode, UserError},};@@ -39,7 +39,7 @@ impl UserServerAPI for UserServerMock {fn update_user(&self, _token: &str, _params: UpdateUserParams) -> ResultFuture<(), UserError> { ResultFuture::new(async { Ok(()) }) }- fn get_user_detail(&self, _token: &str) -> ResultFuture<UserDetail, UserError> {+ fn get_user(&self, _token: &str) -> ResultFuture<UserProfile, UserError> {ResultFuture::new(async { Err(ErrorBuilder::new(ErrorCode::Unknown).msg("mock data, ignore this error").build()) })}}diff --git a/rust-lib/flowy-user/src/services/user/user_session.rs b/rust-lib/flowy-user/src/services/user/user_session.rsindex 85a2c2e7d6..0784a66648 100644--- a/rust-lib/flowy-user/src/services/user/user_session.rs+++ b/rust-lib/flowy-user/src/services/user/user_session.rs@@ -1,5 +1,5 @@use crate::{- entities::{SignInParams, SignUpParams, UpdateUserParams, UserDetail},+ entities::{SignInParams, SignUpParams, UpdateUserParams, UserProfile},errors::{ErrorBuilder, ErrorCode, UserError},services::user::{construct_user_server, database::UserDB},sql_tables::{UserTable, UserTableChangeset},@@ -69,29 +69,29 @@ impl UserSession {self.database.get_pool(&user_id)}- pub async fn sign_in(&self, params: SignInParams) -> Result<UserDetail, UserError> {+ pub async fn sign_in(&self, params: SignInParams) -> Result<UserProfile, UserError> {if self.is_login(¶ms.email) {- self.user_detail().await+ self.user_profile().await} else {let resp = self.server.sign_in(params).await?;let session = Session::new(&resp.uid, &resp.token, &resp.email);let _ = self.set_session(Some(session))?;let user_table = self.save_user(resp.into()).await?;- let user_detail = UserDetail::from(user_table);- Ok(user_detail)+ let user_profile = UserProfile::from(user_table);+ Ok(user_profile)}}- pub async fn sign_up(&self, params: SignUpParams) -> Result<UserDetail, UserError> {+ pub async fn sign_up(&self, params: SignUpParams) -> Result<UserProfile, UserError> {if self.is_login(¶ms.email) {- self.user_detail().await+ self.user_profile().await} else {let resp = self.server.sign_up(params).await?;let session = Session::new(&resp.user_id, &resp.token, &resp.email);let _ = self.set_session(Some(session))?;let user_table = self.save_user(resp.into()).await?;- let user_detail = UserDetail::from(user_table);- Ok(user_detail)+ let user_profile = UserProfile::from(user_table);+ Ok(user_profile)}}@@ -127,15 +127,15 @@ impl UserSession {Ok(())}- pub async fn user_detail(&self) -> Result<UserDetail, UserError> {+ pub async fn user_profile(&self) -> Result<UserProfile, UserError> {let session = self.get_session()?;let token = session.token;let server = self.server.clone();tokio::spawn(async move {- match server.get_user_detail(&token).await {- Ok(user_detail) => {+ match server.get_user(&token).await {+ Ok(profile) => {//- log::info!("{:?}", user_detail);+ log::info!("{:?}", profile);},Err(e) => {//@@ -149,7 +149,7 @@ impl UserSession {.filter(user_table::id.eq(&session.user_id)).first::<UserTable>(&*(self.get_db_connection()?))?;- Ok(UserDetail::from(user))+ Ok(UserProfile::from(user))}pub fn user_dir(&self) -> Result<String, UserError> {diff --git a/rust-lib/flowy-user/tests/event/auth_test.rs b/rust-lib/flowy-user/tests/event/auth_test.rsindex e9f8863472..c3d2ac9af4 100644--- a/rust-lib/flowy-user/tests/event/auth_test.rs+++ b/rust-lib/flowy-user/tests/event/auth_test.rs@@ -50,7 +50,7 @@ fn sign_in_success() {.event(SignIn).request(request).sync_send()- .parse::<UserDetail>();+ .parse::<UserProfile>();dbg!(&response);}diff --git a/rust-lib/flowy-user/tests/event/user_profile_test.rs b/rust-lib/flowy-user/tests/event/user_profile_test.rsindex 6b3d2afedf..7047ba1fca 100644--- a/rust-lib/flowy-user/tests/event/user_profile_test.rs+++ b/rust-lib/flowy-user/tests/event/user_profile_test.rs@@ -9,7 +9,7 @@ use serial_test::*;fn user_profile_get_failed() {let sdk = init_test_sdk();let result = UserTest::new(sdk).event(GetUserProfile).assert_error().sync_send();- assert!(result.user_detail().is_none())+ assert!(result.user_profile().is_none())}#[test]@@ -19,7 +19,7 @@ fn user_profile_get() {let user = UserTest::new(env.sdk.clone()).event(GetUserProfile).sync_send()- .parse::<UserDetail>();+ .parse::<UserProfile>();assert_eq!(env.user, user);}@@ -31,13 +31,13 @@ fn user_update_with_name() {let request = UpdateUserRequest::new(&env.user.id).name(&new_name);let _ = UserTest::new(env.sdk()).event(UpdateUser).request(request).sync_send();- let user_detail = UserTest::new(env.sdk())+ let user_profile = UserTest::new(env.sdk()).event(GetUserProfile).assert_error().sync_send()- .parse::<UserDetail>();+ .parse::<UserProfile>();- assert_eq!(user_detail.name, new_name,);+ assert_eq!(user_profile.name, new_name,);}#[test]@@ -47,13 +47,13 @@ fn user_update_with_email() {let new_email = format!("{}@gmai.com", uuid());let request = UpdateUserRequest::new(&env.user.id).email(&new_email);let _ = UserTest::new(env.sdk()).event(UpdateUser).request(request).sync_send();- let user_detail = UserTest::new(env.sdk())+ let user_profile = UserTest::new(env.sdk()).event(GetUserProfile).assert_error().sync_send()- .parse::<UserDetail>();+ .parse::<UserProfile>();- assert_eq!(user_detail.email, new_email,);+ assert_eq!(user_profile.email, new_email,);}#[test]