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

@ -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