mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: integrate appflowy-cloud (#3359)
* feat: draft: code dependency * chore: update ref * feat: signup using client_api * feat: support auto sign_in after sign_up if already confirmed(WIP) * chore: update collab commit id * chore: fix compile errors * chore: user AFServer trait to provide optional service * chore: refactor workspace * chore: disable aws config * chore: return ws connect * chore: update collab rev * chore: fmt and clippy * chore: fix test * chore: update chrono version * chore: add script to update the collab crates commit id * chore: update --------- Co-authored-by: nathan <nathan@appflowy.io>
This commit is contained in:
@ -12,18 +12,19 @@ bytes = "1.4"
|
||||
anyhow = "1.0"
|
||||
thiserror = "1.0"
|
||||
|
||||
lib-dispatch = { path = "../lib-dispatch", optional = true }
|
||||
lib-dispatch = { workspace = true, optional = true }
|
||||
serde_json = {version = "1.0", optional = true}
|
||||
serde_repr = { version = "0.1" }
|
||||
serde = "1.0"
|
||||
reqwest = { version = "0.11.14", optional = true, features = ["native-tls-vendored"] }
|
||||
flowy-sqlite = { path = "../flowy-sqlite", optional = true}
|
||||
flowy-sqlite = { workspace = true, optional = true}
|
||||
r2d2 = { version = "0.8", optional = true}
|
||||
url = { version = "2.2", optional = true }
|
||||
collab-database = { version = "0.1.0", optional = true }
|
||||
collab-document = { version = "0.1.0", optional = true }
|
||||
tokio-postgres = { version = "0.7.8", optional = true }
|
||||
tokio = { version = "1.0", optional = true }
|
||||
client-api = { version = "0.1.0", optional = true }
|
||||
|
||||
[features]
|
||||
impl_from_dispatch_error = ["lib-dispatch"]
|
||||
@ -34,6 +35,7 @@ impl_from_collab = ["collab-database", "collab-document", "impl_from_reqwest"]
|
||||
impl_from_postgres = ["tokio-postgres"]
|
||||
impl_from_tokio= ["tokio"]
|
||||
impl_from_url= ["url"]
|
||||
impl_from_appflowy_cloud = ["client-api"]
|
||||
dart = ["flowy-codegen/dart"]
|
||||
ts = ["flowy-codegen/ts"]
|
||||
|
||||
|
@ -238,8 +238,18 @@ pub enum ErrorCode {
|
||||
|
||||
#[error("Parse url failed")]
|
||||
InvalidURL = 78,
|
||||
|
||||
#[error("Require Email Confirmation, Sign in after email confirmation")]
|
||||
AwaitingEmailConfirmation = 79,
|
||||
|
||||
#[error("Text id is empty")]
|
||||
TextIdIsEmpty = 79,
|
||||
TextIdIsEmpty = 80,
|
||||
|
||||
#[error("Record already exists")]
|
||||
RecordAlreadyExists = 81,
|
||||
|
||||
#[error("Missing payload")]
|
||||
MissingPayload = 82,
|
||||
}
|
||||
|
||||
impl ErrorCode {
|
||||
|
27
frontend/rust-lib/flowy-error/src/impl_from/cloud.rs
Normal file
27
frontend/rust-lib/flowy-error/src/impl_from/cloud.rs
Normal file
@ -0,0 +1,27 @@
|
||||
use client_api::error::AppError;
|
||||
|
||||
use crate::{ErrorCode, FlowyError};
|
||||
|
||||
impl From<AppError> for FlowyError {
|
||||
fn from(error: AppError) -> Self {
|
||||
let code = match error.code {
|
||||
client_api::error::ErrorCode::Ok => ErrorCode::Internal,
|
||||
client_api::error::ErrorCode::Unhandled => ErrorCode::Internal,
|
||||
client_api::error::ErrorCode::RecordNotFound => ErrorCode::RecordNotFound,
|
||||
client_api::error::ErrorCode::RecordAlreadyExists => ErrorCode::RecordAlreadyExists,
|
||||
client_api::error::ErrorCode::InvalidEmail => ErrorCode::EmailFormatInvalid,
|
||||
client_api::error::ErrorCode::InvalidPassword => ErrorCode::PasswordFormatInvalid,
|
||||
client_api::error::ErrorCode::OAuthError => ErrorCode::UserUnauthorized,
|
||||
client_api::error::ErrorCode::MissingPayload => ErrorCode::MissingPayload,
|
||||
client_api::error::ErrorCode::StorageError => ErrorCode::Internal,
|
||||
client_api::error::ErrorCode::OpenError => ErrorCode::Internal,
|
||||
client_api::error::ErrorCode::InvalidUrl => ErrorCode::InvalidURL,
|
||||
client_api::error::ErrorCode::InvalidRequestParams => ErrorCode::InvalidParams,
|
||||
client_api::error::ErrorCode::UrlMissingParameter => ErrorCode::InvalidParams,
|
||||
client_api::error::ErrorCode::InvalidOAuthProvider => ErrorCode::InvalidAuthConfig,
|
||||
client_api::error::ErrorCode::NotLoggedIn => ErrorCode::UserUnauthorized,
|
||||
};
|
||||
|
||||
FlowyError::new(code, error.message)
|
||||
}
|
||||
}
|
@ -22,5 +22,7 @@ mod postgres;
|
||||
#[cfg(feature = "impl_from_tokio")]
|
||||
mod tokio;
|
||||
|
||||
#[cfg(feature = "impl_from_appflowy_cloud")]
|
||||
mod cloud;
|
||||
#[cfg(feature = "impl_from_url")]
|
||||
mod url;
|
||||
|
Reference in New Issue
Block a user