feat File storage (#3306)

* refactor: file upload

* refactor: support upload plan

* test: add tests
This commit is contained in:
Nathan.fooo
2023-09-01 22:27:29 +08:00
committed by GitHub
parent df8642d446
commit c652c32575
35 changed files with 844 additions and 306 deletions

View File

@ -20,6 +20,7 @@ reqwest = { version = "0.11.14", optional = true, features = ["native-tls-vendor
http-error-code = { git = "https://github.com/AppFlowy-IO/AppFlowy-Server", branch = "refactor/appflowy_server", optional = true }
flowy-sqlite = { path = "../flowy-sqlite", 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 }
@ -34,6 +35,7 @@ impl_from_appflowy_cloud = ["http-error-code"]
impl_from_collab = ["collab-database", "collab-document", "impl_from_reqwest"]
impl_from_postgres = ["tokio-postgres"]
impl_from_tokio= ["tokio"]
impl_from_url= ["url"]
dart = ["flowy-codegen/dart"]
ts = ["flowy-codegen/ts"]

View File

@ -232,6 +232,12 @@ pub enum ErrorCode {
#[error("It appears that the workspace data has not been fully synchronized")]
WorkspaceDataNotSync = 76,
#[error("Excess storage limited")]
ExcessStorageLimited = 77,
#[error("Parse url failed")]
InvalidURL = 78,
}
impl ErrorCode {

View File

@ -24,3 +24,6 @@ mod postgres;
#[cfg(feature = "impl_from_tokio")]
mod tokio;
#[cfg(feature = "impl_from_url")]
mod url;

View File

@ -0,0 +1,7 @@
use crate::{ErrorCode, FlowyError};
impl std::convert::From<url::ParseError> for FlowyError {
fn from(error: url::ParseError) -> Self {
FlowyError::new(ErrorCode::InvalidURL, "").with_context(error)
}
}