chore: reanme flowy-user crate

This commit is contained in:
appflowy 2022-07-19 14:40:56 +08:00
parent 193527e043
commit 8e18d3a937
38 changed files with 148 additions and 146 deletions

View File

@ -51,14 +51,14 @@ void _resolveHomeDeps(GetIt getIt) {
getIt.registerSingleton(MenuSharedState());
getIt.registerFactoryParam<UserListener, UserProfile, void>(
getIt.registerFactoryParam<UserListener, UserProfilePB, void>(
(user, _) => UserListener(userProfile: user),
);
//
getIt.registerLazySingleton<HomeStackManager>(() => HomeStackManager());
getIt.registerFactoryParam<WelcomeBloc, UserProfile, void>(
getIt.registerFactoryParam<WelcomeBloc, UserProfilePB, void>(
(user, _) => WelcomeBloc(
userService: UserService(userId: user.id),
userWorkspaceListener: UserWorkspaceListener(userProfile: user),
@ -73,7 +73,7 @@ void _resolveHomeDeps(GetIt getIt) {
void _resolveFolderDeps(GetIt getIt) {
//workspace
getIt.registerFactoryParam<WorkspaceListener, UserProfile, String>(
getIt.registerFactoryParam<WorkspaceListener, UserProfilePB, String>(
(user, workspaceId) => WorkspaceListener(user: user, workspaceId: workspaceId));
// ViewPB
@ -90,14 +90,14 @@ void _resolveFolderDeps(GetIt getIt) {
);
//Menu
getIt.registerFactoryParam<MenuBloc, UserProfile, String>(
getIt.registerFactoryParam<MenuBloc, UserProfilePB, String>(
(user, workspaceId) => MenuBloc(
workspaceId: workspaceId,
listener: getIt<WorkspaceListener>(param1: user, param2: workspaceId),
),
);
getIt.registerFactoryParam<MenuUserBloc, UserProfile, void>(
getIt.registerFactoryParam<MenuUserBloc, UserProfilePB, void>(
(user, _) => MenuUserBloc(user),
);

View File

@ -1,21 +1,21 @@
import 'package:dartz/dartz.dart';
import 'package:flowy_sdk/dispatch/dispatch.dart';
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show SignInPayload, SignUpPayload, UserProfile;
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show SignInPayloadPB, SignUpPayloadPB, UserProfilePB;
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
class AuthService {
Future<Either<UserProfile, FlowyError>> signIn({required String? email, required String? password}) {
Future<Either<UserProfilePB, FlowyError>> signIn({required String? email, required String? password}) {
//
final request = SignInPayload.create()
final request = SignInPayloadPB.create()
..email = email ?? ''
..password = password ?? '';
return UserEventSignIn(request).send();
}
Future<Either<UserProfile, FlowyError>> signUp(
Future<Either<UserProfilePB, FlowyError>> signUp(
{required String? name, required String? password, required String? email}) {
final request = SignUpPayload.create()
final request = SignUpPayloadPB.create()
..email = email ?? ''
..name = name ?? ''
..password = password ?? '';

View File

@ -2,7 +2,7 @@ import 'package:app_flowy/user/application/auth_service.dart';
import 'package:dartz/dartz.dart';
import 'package:flowy_sdk/protobuf/flowy-error-code/code.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfile;
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfilePB;
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@ -69,7 +69,7 @@ class SignInState with _$SignInState {
required bool isSubmitting,
required Option<String> passwordError,
required Option<String> emailError,
required Option<Either<UserProfile, FlowyError>> successOrFail,
required Option<Either<UserProfilePB, FlowyError>> successOrFail,
}) = _SignInState;
factory SignInState.initial() => SignInState(

View File

@ -2,7 +2,7 @@ import 'package:app_flowy/user/application/auth_service.dart';
import 'package:dartz/dartz.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_sdk/protobuf/flowy-error-code/code.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfile;
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfilePB;
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@ -120,7 +120,7 @@ class SignUpState with _$SignUpState {
required Option<String> passwordError,
required Option<String> repeatPasswordError,
required Option<String> emailError,
required Option<Either<UserProfile, FlowyError>> successOrFail,
required Option<Either<UserProfilePB, FlowyError>> successOrFail,
}) = _SignUpState;
factory SignUpState.initial() => SignUpState(

View File

@ -13,7 +13,7 @@ import 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-user/dart_notification.pb.dart' as user;
import 'package:flowy_sdk/rust_stream.dart';
typedef UserProfileNotifyValue = Either<UserProfile, FlowyError>;
typedef UserProfileNotifyValue = Either<UserProfilePB, FlowyError>;
typedef AuthNotifyValue = Either<Unit, FlowyError>;
class UserListener {
@ -22,9 +22,9 @@ class UserListener {
PublishNotifier<UserProfileNotifyValue>? _profileNotifier = PublishNotifier();
UserNotificationParser? _userParser;
final UserProfile _userProfile;
final UserProfilePB _userProfile;
UserListener({
required UserProfile userProfile,
required UserProfilePB userProfile,
}) : _userProfile = userProfile;
void start({
@ -65,7 +65,7 @@ class UserListener {
break;
case user.UserNotification.UserProfileUpdated:
result.fold(
(payload) => _profileNotifier?.value = left(UserProfile.fromBuffer(payload)),
(payload) => _profileNotifier?.value = left(UserProfilePB.fromBuffer(payload)),
(error) => _profileNotifier?.value = right(error),
);
break;
@ -84,10 +84,10 @@ class UserWorkspaceListener {
PublishNotifier<WorkspaceSettingNotifyValue>? _settingChangedNotifier = PublishNotifier();
FolderNotificationListener? _listener;
final UserProfile _userProfile;
final UserProfilePB _userProfile;
UserWorkspaceListener({
required UserProfile userProfile,
required UserProfilePB userProfile,
}) : _userProfile = userProfile;
void start({

View File

@ -11,7 +11,7 @@ class UserService {
UserService({
required this.userId,
});
Future<Either<UserProfile, FlowyError>> getUserProfile({required String userId}) {
Future<Either<UserProfilePB, FlowyError>> getUserProfile({required String userId}) {
return UserEventGetUserProfile().send();
}
@ -20,7 +20,7 @@ class UserService {
String? password,
String? email,
}) {
var payload = UpdateUserProfilePayload.create()..id = userId;
var payload = UpdateUserProfilePayloadPB.create()..id = userId;
if (name != null) {
payload.name = name;

View File

@ -5,11 +5,11 @@ import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-user/user_setting.pb.dart';
class UserSettingsService {
Future<AppearanceSettings> getAppearanceSettings() async {
Future<AppearanceSettingsPB> getAppearanceSettings() async {
final result = await UserEventGetAppearanceSetting().send();
return result.fold(
(AppearanceSettings setting) {
(AppearanceSettingsPB setting) {
return setting;
},
(error) {
@ -18,7 +18,7 @@ class UserSettingsService {
);
}
Future<Either<Unit, FlowyError>> setAppearanceSettings(AppearanceSettings settings) {
Future<Either<Unit, FlowyError>> setAppearanceSettings(AppearanceSettingsPB settings) {
return UserEventSetAppearanceSetting(settings).send();
}
}

View File

@ -1,11 +1,11 @@
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfile;
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfilePB;
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'auth_state.freezed.dart';
@freezed
class AuthState with _$AuthState {
const factory AuthState.authenticated(UserProfile userProfile) = Authenticated;
const factory AuthState.authenticated(UserProfilePB userProfile) = Authenticated;
const factory AuthState.unauthenticated(FlowyError error) = Unauthenticated;
const factory AuthState.initial() = _Initial;
}

View File

@ -7,7 +7,7 @@ import 'package:app_flowy/user/presentation/welcome_screen.dart';
import 'package:app_flowy/workspace/presentation/home/home_screen.dart';
import 'package:flowy_infra/time/duration.dart';
import 'package:flowy_infra_ui/widget/route/animation.dart';
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfile;
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfilePB;
import 'package:flowy_sdk/protobuf/flowy-folder/protobuf.dart';
import 'package:flutter/material.dart';
@ -16,7 +16,7 @@ class AuthRouter {
// TODO: implement showForgetPasswordScreen
}
void pushWelcomeScreen(BuildContext context, UserProfile userProfile) {
void pushWelcomeScreen(BuildContext context, UserProfilePB userProfile) {
getIt<SplashRoute>().pushWelcomeScreen(context, userProfile);
}
@ -28,7 +28,7 @@ class AuthRouter {
);
}
void pushHomeScreen(BuildContext context, UserProfile profile, CurrentWorkspaceSettingPB workspaceSetting) {
void pushHomeScreen(BuildContext context, UserProfilePB profile, CurrentWorkspaceSettingPB workspaceSetting) {
Navigator.push(
context,
PageRoutes.fade(() => HomeScreen(profile, workspaceSetting), RouteDurations.slow.inMilliseconds * .001),
@ -37,7 +37,7 @@ class AuthRouter {
}
class SplashRoute {
Future<void> pushWelcomeScreen(BuildContext context, UserProfile userProfile) async {
Future<void> pushWelcomeScreen(BuildContext context, UserProfilePB userProfile) async {
final screen = WelcomeScreen(userProfile: userProfile);
final workspaceId = await Navigator.of(context).push(
PageRoutes.fade(
@ -49,7 +49,7 @@ class SplashRoute {
pushHomeScreen(context, userProfile, workspaceId);
}
void pushHomeScreen(BuildContext context, UserProfile userProfile, CurrentWorkspaceSettingPB workspaceSetting) {
void pushHomeScreen(BuildContext context, UserProfilePB userProfile, CurrentWorkspaceSettingPB workspaceSetting) {
Navigator.push(
context,
PageRoutes.fade(() => HomeScreen(userProfile, workspaceSetting), RouteDurations.slow.inMilliseconds * .001),

View File

@ -10,7 +10,7 @@ import 'package:flowy_infra_ui/widget/rounded_input_field.dart';
import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flowy_infra_ui/style_widget/snap_bar.dart';
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfile;
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfilePB;
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:dartz/dartz.dart';
@ -39,7 +39,7 @@ class SignInScreen extends StatelessWidget {
);
}
void _handleSuccessOrFail(Either<UserProfile, FlowyError> result, BuildContext context) {
void _handleSuccessOrFail(Either<UserProfilePB, FlowyError> result, BuildContext context) {
result.fold(
(user) => router.pushWelcomeScreen(context, user),
(error) => showSnapBar(context, error.msg),

View File

@ -8,7 +8,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-error/errors.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfile;
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfilePB;
import 'package:flowy_infra_ui/style_widget/snap_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@ -36,7 +36,7 @@ class SignUpScreen extends StatelessWidget {
);
}
void _handleSuccessOrFail(BuildContext context, Either<UserProfile, FlowyError> result) {
void _handleSuccessOrFail(BuildContext context, Either<UserProfilePB, FlowyError> result) {
result.fold(
(user) => router.pushWelcomeScreen(context, user),
(error) => showSnapBar(context, error.msg),

View File

@ -116,7 +116,7 @@ class _SkipLogInScreenState extends State<SkipLogInScreen> {
void _openCurrentWorkspace(
BuildContext context,
UserProfile user,
UserProfilePB user,
dartz.Either<CurrentWorkspaceSettingPB, FlowyError> workspacesOrError,
) {
workspacesOrError.fold(

View File

@ -12,7 +12,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:app_flowy/generated/locale_keys.g.dart';
class WelcomeScreen extends StatelessWidget {
final UserProfile userProfile;
final UserProfilePB userProfile;
const WelcomeScreen({
Key? key,
required this.userProfile,

View File

@ -9,7 +9,7 @@ import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
class AppearanceSettingModel extends ChangeNotifier with EquatableMixin {
AppearanceSettings setting;
AppearanceSettingsPB setting;
AppTheme _theme;
Locale _locale;
Timer? _saveOperation;

View File

@ -13,7 +13,7 @@ part 'home_bloc.freezed.dart';
class HomeBloc extends Bloc<HomeEvent, HomeState> {
final UserWorkspaceListener _listener;
HomeBloc(UserProfile user, CurrentWorkspaceSettingPB workspaceSetting)
HomeBloc(UserProfilePB user, CurrentWorkspaceSettingPB workspaceSetting)
: _listener = UserWorkspaceListener(userProfile: user),
super(HomeState.initial(workspaceSetting)) {
on<HomeEvent>((event, emit) async {

View File

@ -14,7 +14,7 @@ class MenuUserBloc extends Bloc<MenuUserEvent, MenuUserState> {
final UserService _userService;
final UserListener _userListener;
final UserWorkspaceListener _userWorkspaceListener;
final UserProfile userProfile;
final UserProfilePB userProfile;
MenuUserBloc(this.userProfile)
: _userListener = UserListener(userProfile: userProfile),
@ -31,7 +31,7 @@ class MenuUserBloc extends Bloc<MenuUserEvent, MenuUserState> {
fetchWorkspaces: () async {
//
},
didReceiveUserProfile: (UserProfile newUserProfile) {
didReceiveUserProfile: (UserProfilePB newUserProfile) {
emit(state.copyWith(userProfile: newUserProfile));
},
updateUserName: (String name) {
@ -58,7 +58,7 @@ class MenuUserBloc extends Bloc<MenuUserEvent, MenuUserState> {
result.fold((l) => null, (error) => Log.error(error));
}
void _profileUpdated(Either<UserProfile, FlowyError> userProfileOrFailed) {
void _profileUpdated(Either<UserProfilePB, FlowyError> userProfileOrFailed) {
userProfileOrFailed.fold(
(newUserProfile) => add(MenuUserEvent.didReceiveUserProfile(newUserProfile)),
(err) => Log.error(err),
@ -75,18 +75,18 @@ class MenuUserEvent with _$MenuUserEvent {
const factory MenuUserEvent.initial() = _Initial;
const factory MenuUserEvent.fetchWorkspaces() = _FetchWorkspaces;
const factory MenuUserEvent.updateUserName(String name) = _UpdateUserName;
const factory MenuUserEvent.didReceiveUserProfile(UserProfile newUserProfile) = _DidReceiveUserProfile;
const factory MenuUserEvent.didReceiveUserProfile(UserProfilePB newUserProfile) = _DidReceiveUserProfile;
}
@freezed
class MenuUserState with _$MenuUserState {
const factory MenuUserState({
required UserProfile userProfile,
required UserProfilePB userProfile,
required Option<List<WorkspacePB>> workspaces,
required Either<Unit, String> successOrFailure,
}) = _MenuUserState;
factory MenuUserState.initial(UserProfile userProfile) => MenuUserState(
factory MenuUserState.initial(UserProfilePB userProfile) => MenuUserState(
userProfile: userProfile,
workspaces: none(),
successOrFailure: left(unit),

View File

@ -3,7 +3,7 @@ import 'dart:typed_data';
import 'package:app_flowy/core/folder_notification.dart';
import 'package:dartz/dartz.dart';
import 'package:flowy_infra/notifier.dart';
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfile;
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfilePB;
import 'package:flowy_sdk/protobuf/flowy-folder/app.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-folder/workspace.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
@ -17,7 +17,7 @@ class WorkspaceListener {
PublishNotifier<WorkspaceNotifyValue>? _workspaceUpdatedNotifier = PublishNotifier();
FolderNotificationListener? _listener;
final UserProfile user;
final UserProfilePB user;
final String workspaceId;
WorkspaceListener({

View File

@ -5,7 +5,7 @@ import 'package:app_flowy/workspace/presentation/widgets/float_bubble/question_b
import 'package:app_flowy/startup/startup.dart';
import 'package:flowy_sdk/log.dart';
import 'package:flowy_infra_ui/style_widget/container.dart';
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfile;
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfilePB;
import 'package:flowy_sdk/protobuf/flowy-folder/protobuf.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@ -18,7 +18,7 @@ import 'home_stack.dart';
import 'menu/menu.dart';
class HomeScreen extends StatefulWidget {
final UserProfile user;
final UserProfilePB user;
final CurrentWorkspaceSettingPB workspaceSetting;
const HomeScreen(this.user, this.workspaceSetting, {Key? key}) : super(key: key);

View File

@ -10,7 +10,7 @@ import 'package:flowy_infra/size.dart';
import 'package:flowy_infra/theme.dart';
import 'package:flowy_infra_ui/style_widget/scrolling/styled_list.dart';
import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfile;
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfilePB;
import 'package:flowy_sdk/protobuf/flowy-folder/view.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-folder/workspace.pb.dart';
import 'package:flutter/material.dart';
@ -32,7 +32,7 @@ import 'menu_user.dart';
class HomeMenu extends StatelessWidget {
final PublishNotifier<bool> _collapsedNotifier;
final UserProfile user;
final UserProfilePB user;
final CurrentWorkspaceSettingPB workspaceSetting;
const HomeMenu({

View File

@ -6,14 +6,14 @@ import 'package:flowy_infra/size.dart';
import 'package:flowy_infra/theme.dart';
import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfile;
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfilePB;
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:app_flowy/generated/locale_keys.g.dart';
import 'package:easy_localization/easy_localization.dart';
class MenuUser extends StatelessWidget {
final UserProfile user;
final UserProfilePB user;
MenuUser(this.user, {Key? key}) : super(key: ValueKey(user.id));
@override

View File

@ -14,7 +14,7 @@ class FlowyTest {
return FlowyTest();
}
Future<UserProfile> signIn() async {
Future<UserProfilePB> signIn() async {
final authService = getIt<AuthService>();
const password = "AppFlowy123@";
final uid = uuid();

View File

@ -7,7 +7,7 @@ import 'package:bloc_test/bloc_test.dart';
import 'util/test_env.dart';
void main() {
UserProfile? userInfo;
UserProfilePB? userInfo;
setUpAll(() async {
final flowyTest = await FlowyTest.setup();
userInfo = await flowyTest.signIn();

View File

@ -1,7 +1,7 @@
use crate::{configuration::*, request::HttpRequestBuilder};
use flowy_error::FlowyError;
use flowy_user::entities::{
SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserProfileParams, UserProfile,
SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserProfileParams, UserProfilePB,
};
use flowy_user::event_map::UserCloudService;
use http_flowy::errors::ServerError;
@ -51,7 +51,7 @@ impl UserCloudService for UserHttpCloudService {
})
}
fn get_user(&self, token: &str) -> FutureResult<UserProfile, FlowyError> {
fn get_user(&self, token: &str) -> FutureResult<UserProfilePB, FlowyError> {
let token = token.to_owned();
let url = self.config.user_profile_url();
FutureResult::new(async move {
@ -92,7 +92,7 @@ pub async fn user_sign_out_request(token: &str, url: &str) -> Result<(), ServerE
Ok(())
}
pub async fn get_user_profile_request(token: &str, url: &str) -> Result<UserProfile, ServerError> {
pub async fn get_user_profile_request(token: &str, url: &str) -> Result<UserProfilePB, ServerError> {
let user_profile = request_builder()
.get(&url.to_owned())
.header(HEADER_TOKEN, token)

View File

@ -263,7 +263,7 @@ use flowy_folder_data_model::revision::{
};
use flowy_text_block::BlockCloudService;
use flowy_user::entities::{
SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserProfileParams, UserProfile,
SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserProfileParams, UserProfilePB,
};
use flowy_user::event_map::UserCloudService;
use lib_infra::{future::FutureResult, util::timestamp};
@ -405,8 +405,8 @@ impl UserCloudService for LocalServer {
FutureResult::new(async { Ok(()) })
}
fn get_user(&self, _token: &str) -> FutureResult<UserProfile, FlowyError> {
FutureResult::new(async { Ok(UserProfile::default()) })
fn get_user(&self, _token: &str) -> FutureResult<UserProfilePB, FlowyError> {
FutureResult::new(async { Ok(UserProfilePB::default()) })
}
fn ws_addr(&self) -> String {

View File

@ -1,5 +1,5 @@
use crate::FlowySDKTest;
use flowy_user::{entities::UserProfile, errors::FlowyError};
use flowy_user::{entities::UserProfilePB, errors::FlowyError};
use lib_dispatch::prelude::{EventDispatcher, EventResponse, FromBytes, ModuleRequest, StatusCode, ToBytes, *};
use std::{
convert::TryFrom,
@ -14,7 +14,7 @@ impl FolderEventBuilder {
pub fn new(sdk: FlowySDKTest) -> Self {
EventBuilder::test(TestContext::new(sdk))
}
pub fn user_profile(&self) -> &Option<UserProfile> {
pub fn user_profile(&self) -> &Option<UserProfilePB> {
&self.user_profile
}
}
@ -24,7 +24,7 @@ pub type UserModuleEventBuilder = FolderEventBuilder;
#[derive(Clone)]
pub struct EventBuilder<E> {
context: TestContext,
user_profile: Option<UserProfile>,
user_profile: Option<UserProfilePB>,
err_phantom: PhantomData<E>,
}

View File

@ -9,7 +9,7 @@ use flowy_folder::{
event_map::FolderEvent::{CreateWorkspace, OpenWorkspace, *},
};
use flowy_user::{
entities::{SignInPayload, SignUpPayload, UserProfile},
entities::{SignInPayloadPB, SignUpPayloadPB, UserProfilePB},
errors::FlowyError,
event_map::UserEvent::{InitUser, SignIn, SignOut, SignUp},
};
@ -138,13 +138,13 @@ pub fn login_password() -> String {
}
pub struct SignUpContext {
pub user_profile: UserProfile,
pub user_profile: UserProfilePB,
pub password: String,
}
pub fn sign_up(dispatch: Arc<EventDispatcher>) -> SignUpContext {
let password = login_password();
let payload = SignUpPayload {
let payload = SignUpPayloadPB {
email: random_email(),
name: "app flowy".to_string(),
password: password.clone(),
@ -154,7 +154,7 @@ pub fn sign_up(dispatch: Arc<EventDispatcher>) -> SignUpContext {
let request = ModuleRequest::new(SignUp).payload(payload);
let user_profile = EventDispatcher::sync_send(dispatch, request)
.parse::<UserProfile, FlowyError>()
.parse::<UserProfilePB, FlowyError>()
.unwrap()
.unwrap();
@ -164,7 +164,7 @@ pub fn sign_up(dispatch: Arc<EventDispatcher>) -> SignUpContext {
pub async fn async_sign_up(dispatch: Arc<EventDispatcher>) -> SignUpContext {
let password = login_password();
let email = random_email();
let payload = SignUpPayload {
let payload = SignUpPayloadPB {
email,
name: "app flowy".to_string(),
password: password.clone(),
@ -175,7 +175,7 @@ pub async fn async_sign_up(dispatch: Arc<EventDispatcher>) -> SignUpContext {
let request = ModuleRequest::new(SignUp).payload(payload);
let user_profile = EventDispatcher::async_send(dispatch.clone(), request)
.await
.parse::<UserProfile, FlowyError>()
.parse::<UserProfilePB, FlowyError>()
.unwrap()
.unwrap();
@ -189,8 +189,8 @@ pub async fn init_user_setting(dispatch: Arc<EventDispatcher>) {
}
#[allow(dead_code)]
fn sign_in(dispatch: Arc<EventDispatcher>) -> UserProfile {
let payload = SignInPayload {
fn sign_in(dispatch: Arc<EventDispatcher>) -> UserProfilePB {
let payload = SignInPayloadPB {
email: login_email(),
password: login_password(),
name: "rust".to_owned(),
@ -200,7 +200,7 @@ fn sign_in(dispatch: Arc<EventDispatcher>) -> UserProfile {
let request = ModuleRequest::new(SignIn).payload(payload);
EventDispatcher::sync_send(dispatch, request)
.parse::<UserProfile, FlowyError>()
.parse::<UserProfilePB, FlowyError>()
.unwrap()
.unwrap()
}

View File

@ -4,7 +4,7 @@ pub mod helper;
use crate::helper::*;
use flowy_net::{get_client_server_configuration, ClientServerConfiguration};
use flowy_sdk::{FlowySDK, FlowySDKConfig};
use flowy_user::entities::UserProfile;
use flowy_user::entities::UserProfilePB;
use nanoid::nanoid;
pub mod prelude {
@ -47,7 +47,7 @@ impl FlowySDKTest {
context
}
pub async fn init_user(&self) -> UserProfile {
pub async fn init_user(&self) -> UserProfilePB {
let context = async_sign_up(self.inner.dispatcher()).await;
init_user_setting(self.inner.dispatcher()).await;
context.user_profile

View File

@ -4,7 +4,7 @@ use flowy_derive::ProtoBuf;
use std::convert::TryInto;
#[derive(ProtoBuf, Default)]
pub struct SignInPayload {
pub struct SignInPayloadPB {
#[pb(index = 1)]
pub email: String,
@ -42,7 +42,7 @@ pub struct SignInResponse {
pub token: String,
}
impl TryInto<SignInParams> for SignInPayload {
impl TryInto<SignInParams> for SignInPayloadPB {
type Error = ErrorCode;
fn try_into(self) -> Result<SignInParams, Self::Error> {
@ -58,7 +58,7 @@ impl TryInto<SignInParams> for SignInPayload {
}
#[derive(ProtoBuf, Default)]
pub struct SignUpPayload {
pub struct SignUpPayloadPB {
#[pb(index = 1)]
pub email: String,
@ -68,7 +68,7 @@ pub struct SignUpPayload {
#[pb(index = 3)]
pub password: String,
}
impl TryInto<SignUpParams> for SignUpPayload {
impl TryInto<SignUpParams> for SignUpPayloadPB {
type Error = ErrorCode;
fn try_into(self) -> Result<SignUpParams, Self::Error> {

View File

@ -7,13 +7,13 @@ use crate::{
};
#[derive(Default, ProtoBuf)]
pub struct UserToken {
pub struct UserTokenPB {
#[pb(index = 1)]
pub token: String,
}
#[derive(ProtoBuf, Default, Debug, PartialEq, Eq, Clone)]
pub struct UserProfile {
pub struct UserProfilePB {
#[pb(index = 1)]
pub id: String,
@ -28,7 +28,7 @@ pub struct UserProfile {
}
#[derive(ProtoBuf, Default)]
pub struct UpdateUserProfilePayload {
pub struct UpdateUserProfilePayloadPB {
#[pb(index = 1)]
pub id: String,
@ -42,7 +42,7 @@ pub struct UpdateUserProfilePayload {
pub password: Option<String>,
}
impl UpdateUserProfilePayload {
impl UpdateUserProfilePayloadPB {
pub fn new(id: &str) -> Self {
Self {
id: id.to_owned(),
@ -85,7 +85,9 @@ impl UpdateUserProfileParams {
pub fn new(user_id: &str) -> Self {
Self {
id: user_id.to_owned(),
..Default::default()
name: None,
email: None,
password: None,
}
}
@ -105,7 +107,7 @@ impl UpdateUserProfileParams {
}
}
impl TryInto<UpdateUserProfileParams> for UpdateUserProfilePayload {
impl TryInto<UpdateUserProfileParams> for UpdateUserProfilePayloadPB {
type Error = ErrorCode;
fn try_into(self) -> Result<UpdateUserProfileParams, Self::Error> {

View File

@ -2,22 +2,22 @@ use flowy_derive::ProtoBuf;
use serde::{Deserialize, Serialize};
#[derive(ProtoBuf, Default, Debug, Clone)]
pub struct UserPreferences {
pub struct UserPreferencesPB {
#[pb(index = 1)]
user_id: String,
#[pb(index = 2)]
appearance_setting: AppearanceSettings,
appearance_setting: AppearanceSettingsPB,
}
#[derive(ProtoBuf, Serialize, Deserialize, Debug, Clone)]
pub struct AppearanceSettings {
pub struct AppearanceSettingsPB {
#[pb(index = 1)]
pub theme: String,
#[pb(index = 2)]
#[serde(default)]
pub locale: LocaleSettings,
pub locale: LocaleSettingsPB,
#[pb(index = 3)]
#[serde(default = "DEFAULT_RESET_VALUE")]
@ -27,7 +27,7 @@ pub struct AppearanceSettings {
const DEFAULT_RESET_VALUE: fn() -> bool = || APPEARANCE_RESET_AS_DEFAULT;
#[derive(ProtoBuf, Serialize, Deserialize, Debug, Clone)]
pub struct LocaleSettings {
pub struct LocaleSettingsPB {
#[pb(index = 1)]
pub language_code: String,
@ -35,7 +35,7 @@ pub struct LocaleSettings {
pub country_code: String,
}
impl std::default::Default for LocaleSettings {
impl std::default::Default for LocaleSettingsPB {
fn default() -> Self {
Self {
language_code: "en".to_owned(),
@ -47,11 +47,11 @@ impl std::default::Default for LocaleSettings {
pub const APPEARANCE_DEFAULT_THEME: &str = "light";
const APPEARANCE_RESET_AS_DEFAULT: bool = true;
impl std::default::Default for AppearanceSettings {
impl std::default::Default for AppearanceSettingsPB {
fn default() -> Self {
AppearanceSettings {
AppearanceSettingsPB {
theme: APPEARANCE_DEFAULT_THEME.to_owned(),
locale: LocaleSettings::default(),
locale: LocaleSettingsPB::default(),
reset_as_default: APPEARANCE_RESET_AS_DEFAULT,
}
}

View File

@ -1,5 +1,5 @@
use crate::entities::{
SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserProfileParams, UserProfile,
SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserProfileParams, UserProfilePB,
};
use crate::{errors::FlowyError, handlers::*, services::UserSession};
use lib_dispatch::prelude::*;
@ -26,7 +26,7 @@ pub trait UserCloudService: Send + Sync {
fn sign_in(&self, params: SignInParams) -> FutureResult<SignInResponse, FlowyError>;
fn sign_out(&self, token: &str) -> FutureResult<(), FlowyError>;
fn update_user(&self, token: &str, params: UpdateUserProfileParams) -> FutureResult<(), FlowyError>;
fn get_user(&self, token: &str) -> FutureResult<UserProfile, FlowyError>;
fn get_user(&self, token: &str) -> FutureResult<UserProfilePB, FlowyError>;
fn ws_addr(&self) -> String;
}
@ -39,27 +39,27 @@ pub enum UserEvent {
#[event()]
InitUser = 0,
#[event(input = "SignInPayload", output = "UserProfile")]
#[event(input = "SignInPayloadPB", output = "UserProfilePB")]
SignIn = 1,
#[event(input = "SignUpPayload", output = "UserProfile")]
#[event(input = "SignUpPayloadPB", output = "UserProfilePB")]
SignUp = 2,
#[event(passthrough)]
SignOut = 3,
#[event(input = "UpdateUserProfilePayload")]
#[event(input = "UpdateUserProfilePayloadPB")]
UpdateUserProfile = 4,
#[event(output = "UserProfile")]
#[event(output = "UserProfilePB")]
GetUserProfile = 5,
#[event(output = "UserProfile")]
#[event(output = "UserProfilePB")]
CheckUser = 6,
#[event(input = "AppearanceSettings")]
#[event(input = "AppearanceSettingsPB")]
SetAppearanceSetting = 7,
#[event(output = "AppearanceSettings")]
#[event(output = "AppearanceSettingsPB")]
GetAppearanceSetting = 8,
}

View File

@ -7,9 +7,9 @@ use std::{convert::TryInto, sync::Arc};
// tracing instrument 👉🏻 https://docs.rs/tracing/0.1.26/tracing/attr.instrument.html
#[tracing::instrument(level = "debug", name = "sign_in", skip(data, session), fields(email = %data.email), err)]
pub async fn sign_in(
data: Data<SignInPayload>,
data: Data<SignInPayloadPB>,
session: AppData<Arc<UserSession>>,
) -> DataResult<UserProfile, FlowyError> {
) -> DataResult<UserProfilePB, FlowyError> {
let params: SignInParams = data.into_inner().try_into()?;
let user_profile = session.sign_in(params).await?;
data_result(user_profile)
@ -26,9 +26,9 @@ pub async fn sign_in(
err
)]
pub async fn sign_up(
data: Data<SignUpPayload>,
data: Data<SignUpPayloadPB>,
session: AppData<Arc<UserSession>>,
) -> DataResult<UserProfile, FlowyError> {
) -> DataResult<UserProfilePB, FlowyError> {
let params: SignUpParams = data.into_inner().try_into()?;
let user_profile = session.sign_up(params).await?;

View File

@ -1,5 +1,5 @@
use crate::entities::{
AppearanceSettings, UpdateUserProfileParams, UpdateUserProfilePayload, UserProfile, APPEARANCE_DEFAULT_THEME,
AppearanceSettingsPB, UpdateUserProfileParams, UpdateUserProfilePayloadPB, UserProfilePB, APPEARANCE_DEFAULT_THEME,
};
use crate::{errors::FlowyError, services::UserSession};
use flowy_database::kv::KV;
@ -13,13 +13,13 @@ pub async fn init_user_handler(session: AppData<Arc<UserSession>>) -> Result<(),
}
#[tracing::instrument(level = "debug", skip(session))]
pub async fn check_user_handler(session: AppData<Arc<UserSession>>) -> DataResult<UserProfile, FlowyError> {
pub async fn check_user_handler(session: AppData<Arc<UserSession>>) -> DataResult<UserProfilePB, FlowyError> {
let user_profile = session.check_user().await?;
data_result(user_profile)
}
#[tracing::instrument(level = "debug", skip(session))]
pub async fn get_user_profile_handler(session: AppData<Arc<UserSession>>) -> DataResult<UserProfile, FlowyError> {
pub async fn get_user_profile_handler(session: AppData<Arc<UserSession>>) -> DataResult<UserProfilePB, FlowyError> {
let user_profile = session.get_user_profile().await?;
data_result(user_profile)
}
@ -32,7 +32,7 @@ pub async fn sign_out(session: AppData<Arc<UserSession>>) -> Result<(), FlowyErr
#[tracing::instrument(level = "debug", skip(data, session))]
pub async fn update_user_profile_handler(
data: Data<UpdateUserProfilePayload>,
data: Data<UpdateUserProfilePayloadPB>,
session: AppData<Arc<UserSession>>,
) -> Result<(), FlowyError> {
let params: UpdateUserProfileParams = data.into_inner().try_into()?;
@ -43,7 +43,7 @@ pub async fn update_user_profile_handler(
const APPEARANCE_SETTING_CACHE_KEY: &str = "appearance_settings";
#[tracing::instrument(level = "debug", skip(data), err)]
pub async fn set_appearance_setting(data: Data<AppearanceSettings>) -> Result<(), FlowyError> {
pub async fn set_appearance_setting(data: Data<AppearanceSettingsPB>) -> Result<(), FlowyError> {
let mut setting = data.into_inner();
if setting.theme.is_empty() {
setting.theme = APPEARANCE_DEFAULT_THEME.to_string();
@ -55,15 +55,15 @@ pub async fn set_appearance_setting(data: Data<AppearanceSettings>) -> Result<()
}
#[tracing::instrument(err)]
pub async fn get_appearance_setting() -> DataResult<AppearanceSettings, FlowyError> {
pub async fn get_appearance_setting() -> DataResult<AppearanceSettingsPB, FlowyError> {
match KV::get_str(APPEARANCE_SETTING_CACHE_KEY) {
None => data_result(AppearanceSettings::default()),
None => data_result(AppearanceSettingsPB::default()),
Some(s) => {
let setting = match serde_json::from_str(&s) {
Ok(setting) => setting,
Err(e) => {
tracing::error!("Deserialize AppearanceSettings failed: {:?}, fallback to default", e);
AppearanceSettings::default()
AppearanceSettingsPB::default()
}
};
data_result(setting)

View File

@ -1,4 +1,4 @@
use crate::entities::{SignInResponse, SignUpResponse, UpdateUserProfileParams, UserProfile};
use crate::entities::{SignInResponse, SignUpResponse, UpdateUserProfileParams, UserProfilePB};
use flowy_database::ConnectionPool;
use flowy_database::{schema::user_table, DBConnection, Database};
use flowy_error::{ErrorCode, FlowyError};
@ -113,9 +113,9 @@ impl std::convert::From<SignInResponse> for UserTable {
}
}
impl std::convert::From<UserTable> for UserProfile {
impl std::convert::From<UserTable> for UserProfilePB {
fn from(table: UserTable) -> Self {
UserProfile {
UserProfilePB {
id: table.id,
email: table.email,
name: table.name,

View File

@ -1,4 +1,4 @@
use crate::entities::UserProfile;
use crate::entities::UserProfilePB;
use tokio::sync::{broadcast, mpsc};
#[derive(Clone)]
@ -14,7 +14,7 @@ pub enum UserStatus {
token: String,
},
SignUp {
profile: UserProfile,
profile: UserProfilePB,
ret: mpsc::Sender<()>,
},
}
@ -42,7 +42,7 @@ impl UserNotifier {
});
}
pub(crate) fn notify_sign_up(&self, ret: mpsc::Sender<()>, user_profile: &UserProfile) {
pub(crate) fn notify_sign_up(&self, ret: mpsc::Sender<()>, user_profile: &UserProfilePB) {
let _ = self.user_status_notifier.send(UserStatus::SignUp {
profile: user_profile.clone(),
ret,

View File

@ -1,5 +1,5 @@
use crate::entities::{
SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserProfileParams, UserProfile,
SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserProfileParams, UserProfilePB,
};
use crate::{
dart_notification::*,
@ -80,7 +80,7 @@ impl UserSession {
}
#[tracing::instrument(level = "debug", skip(self))]
pub async fn sign_in(&self, params: SignInParams) -> Result<UserProfile, FlowyError> {
pub async fn sign_in(&self, params: SignInParams) -> Result<UserProfilePB, FlowyError> {
if self.is_user_login(&params.email) {
self.get_user_profile().await
} else {
@ -88,14 +88,14 @@ impl UserSession {
let session: Session = resp.clone().into();
let _ = self.set_session(Some(session))?;
let user_table = self.save_user(resp.into()).await?;
let user_profile: UserProfile = user_table.into();
let user_profile: UserProfilePB = user_table.into();
self.notifier.notify_login(&user_profile.token, &user_profile.id);
Ok(user_profile)
}
}
#[tracing::instrument(level = "debug", skip(self))]
pub async fn sign_up(&self, params: SignUpParams) -> Result<UserProfile, FlowyError> {
pub async fn sign_up(&self, params: SignUpParams) -> Result<UserProfilePB, FlowyError> {
if self.is_user_login(&params.email) {
self.get_user_profile().await
} else {
@ -103,7 +103,7 @@ impl UserSession {
let session: Session = resp.clone().into();
let _ = self.set_session(Some(session))?;
let user_table = self.save_user(resp.into()).await?;
let user_profile: UserProfile = user_table.into();
let user_profile: UserProfilePB = user_table.into();
let (ret, mut tx) = mpsc::channel(1);
self.notifier.notify_sign_up(ret, &user_profile);
@ -143,7 +143,7 @@ impl UserSession {
Ok(())
}
pub async fn check_user(&self) -> Result<UserProfile, FlowyError> {
pub async fn check_user(&self) -> Result<UserProfilePB, FlowyError> {
let (user_id, token) = self.get_session()?.into_part();
let user = dsl::user_table
@ -154,7 +154,7 @@ impl UserSession {
Ok(user.into())
}
pub async fn get_user_profile(&self) -> Result<UserProfile, FlowyError> {
pub async fn get_user_profile(&self) -> Result<UserProfilePB, FlowyError> {
let (user_id, token) = self.get_session()?.into_part();
let user = dsl::user_table
.filter(user_table::id.eq(&user_id))

View File

@ -1,13 +1,13 @@
use crate::helper::*;
use flowy_test::{event_builder::UserModuleEventBuilder, FlowySDKTest};
use flowy_user::entities::{SignInPayload, SignUpPayload, UserProfile};
use flowy_user::entities::{SignInPayloadPB, SignUpPayloadPB, UserProfilePB};
use flowy_user::{errors::ErrorCode, event_map::UserEvent::*};
#[tokio::test]
async fn sign_up_with_invalid_email() {
for email in invalid_email_test_case() {
let sdk = FlowySDKTest::default();
let request = SignUpPayload {
let request = SignUpPayloadPB {
email: email.to_string(),
name: valid_name(),
password: login_password(),
@ -29,7 +29,7 @@ async fn sign_up_with_invalid_email() {
async fn sign_up_with_invalid_password() {
for password in invalid_password_test_case() {
let sdk = FlowySDKTest::default();
let request = SignUpPayload {
let request = SignUpPayloadPB {
email: random_email(),
name: valid_name(),
password,
@ -50,7 +50,7 @@ async fn sign_in_success() {
let _ = UserModuleEventBuilder::new(test.clone()).event(SignOut).sync_send();
let sign_up_context = test.sign_up().await;
let request = SignInPayload {
let request = SignInPayloadPB {
email: sign_up_context.user_profile.email.clone(),
password: sign_up_context.password.clone(),
name: "".to_string(),
@ -61,7 +61,7 @@ async fn sign_in_success() {
.payload(request)
.async_send()
.await
.parse::<UserProfile>();
.parse::<UserProfilePB>();
dbg!(&response);
}
@ -69,7 +69,7 @@ async fn sign_in_success() {
async fn sign_in_with_invalid_email() {
for email in invalid_email_test_case() {
let sdk = FlowySDKTest::default();
let request = SignInPayload {
let request = SignInPayloadPB {
email: email.to_string(),
password: login_password(),
name: "".to_string(),
@ -93,7 +93,7 @@ async fn sign_in_with_invalid_password() {
for password in invalid_password_test_case() {
let sdk = FlowySDKTest::default();
let request = SignInPayload {
let request = SignInPayloadPB {
email: random_email(),
password,
name: "".to_string(),

View File

@ -1,6 +1,6 @@
use crate::helper::*;
use flowy_test::{event_builder::UserModuleEventBuilder, FlowySDKTest};
use flowy_user::entities::{UpdateUserProfilePayload, UserProfile};
use flowy_user::entities::{UpdateUserProfilePayloadPB, UserProfilePB};
use flowy_user::{errors::ErrorCode, event_map::UserEvent::*};
use nanoid::nanoid;
@ -24,7 +24,7 @@ async fn user_profile_get() {
let user = UserModuleEventBuilder::new(test.clone())
.event(GetUserProfile)
.sync_send()
.parse::<UserProfile>();
.parse::<UserProfilePB>();
assert_eq!(user_profile, user);
}
@ -33,7 +33,7 @@ async fn user_update_with_name() {
let sdk = FlowySDKTest::default();
let user = sdk.init_user().await;
let new_name = "hello_world".to_owned();
let request = UpdateUserProfilePayload::new(&user.id).name(&new_name);
let request = UpdateUserProfilePayloadPB::new(&user.id).name(&new_name);
let _ = UserModuleEventBuilder::new(sdk.clone())
.event(UpdateUserProfile)
.payload(request)
@ -43,7 +43,7 @@ async fn user_update_with_name() {
.event(GetUserProfile)
.assert_error()
.sync_send()
.parse::<UserProfile>();
.parse::<UserProfilePB>();
assert_eq!(user_profile.name, new_name,);
}
@ -53,7 +53,7 @@ async fn user_update_with_email() {
let sdk = FlowySDKTest::default();
let user = sdk.init_user().await;
let new_email = format!("{}@gmail.com", nanoid!(6));
let request = UpdateUserProfilePayload::new(&user.id).email(&new_email);
let request = UpdateUserProfilePayloadPB::new(&user.id).email(&new_email);
let _ = UserModuleEventBuilder::new(sdk.clone())
.event(UpdateUserProfile)
.payload(request)
@ -62,7 +62,7 @@ async fn user_update_with_email() {
.event(GetUserProfile)
.assert_error()
.sync_send()
.parse::<UserProfile>();
.parse::<UserProfilePB>();
assert_eq!(user_profile.email, new_email,);
}
@ -72,7 +72,7 @@ async fn user_update_with_password() {
let sdk = FlowySDKTest::default();
let user = sdk.init_user().await;
let new_password = "H123world!".to_owned();
let request = UpdateUserProfilePayload::new(&user.id).password(&new_password);
let request = UpdateUserProfilePayloadPB::new(&user.id).password(&new_password);
let _ = UserModuleEventBuilder::new(sdk.clone())
.event(UpdateUserProfile)
@ -86,7 +86,7 @@ async fn user_update_with_invalid_email() {
let test = FlowySDKTest::default();
let user = test.init_user().await;
for email in invalid_email_test_case() {
let request = UpdateUserProfilePayload::new(&user.id).email(&email);
let request = UpdateUserProfilePayloadPB::new(&user.id).email(&email);
assert_eq!(
UserModuleEventBuilder::new(test.clone())
.event(UpdateUserProfile)
@ -104,7 +104,7 @@ async fn user_update_with_invalid_password() {
let test = FlowySDKTest::default();
let user = test.init_user().await;
for password in invalid_password_test_case() {
let request = UpdateUserProfilePayload::new(&user.id).password(&password);
let request = UpdateUserProfilePayloadPB::new(&user.id).password(&password);
UserModuleEventBuilder::new(test.clone())
.event(UpdateUserProfile)
@ -118,7 +118,7 @@ async fn user_update_with_invalid_password() {
async fn user_update_with_invalid_name() {
let test = FlowySDKTest::default();
let user = test.init_user().await;
let request = UpdateUserProfilePayload::new(&user.id).name("");
let request = UpdateUserProfilePayloadPB::new(&user.id).name("");
UserModuleEventBuilder::new(test.clone())
.event(UpdateUserProfile)
.payload(request)