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:
Zack
2023-09-17 17:14:34 +08:00
committed by GitHub
parent cecd4f48ab
commit 1c84ee1d53
94 changed files with 2681 additions and 2898 deletions

View File

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

View 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)
}
}

View File

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