mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
[rust]: config flowy-workspace crate struct
This commit is contained in:
parent
019f7cc45d
commit
f35b756459
@ -61,7 +61,7 @@ byteorder = {version = "1.3.4"}
|
||||
async-stream = "0.3.2"
|
||||
|
||||
flowy-user = { path = "../rust-lib/flowy-user" }
|
||||
flowy-workspace = { path = "../rust-lib/flowy-workspace" }
|
||||
flowy-workspace = { path = "../rust-lib/flowy-workspace", default-features = false, features = ["backend_service"]}
|
||||
flowy-document = { path = "../rust-lib/flowy-document" }
|
||||
flowy-ws = { path = "../rust-lib/flowy-ws" }
|
||||
flowy-ot = { path = "../rust-lib/flowy-ot" }
|
||||
@ -100,7 +100,7 @@ once_cell = "1.7.2"
|
||||
linkify = "0.5.0"
|
||||
backend = { path = ".", features = ["flowy_test"]}
|
||||
flowy-user = { path = "../rust-lib/flowy-user", features = ["http_server"] }
|
||||
flowy-workspace = { path = "../rust-lib/flowy-workspace", features = ["http_server"] }
|
||||
flowy-workspace = { path = "../rust-lib/flowy-workspace", default-features = false, features = ["http_server", "backend_service"] }
|
||||
flowy-ws = { path = "../rust-lib/flowy-ws" }
|
||||
flowy-sdk = { path = "../rust-lib/flowy-sdk" }
|
||||
flowy-test = { path = "../rust-lib/flowy-test" }
|
||||
|
0
backend/graph.png
Normal file
0
backend/graph.png
Normal file
@ -1,5 +1,5 @@
|
||||
use chrono::Utc;
|
||||
use flowy_workspace::protobuf::{App, RepeatedView, Trash, TrashType, View, ViewType};
|
||||
use flowy_workspace::backend_service::{App, RepeatedView, Trash, TrashType, View, ViewType};
|
||||
use protobuf::ProtobufEnum;
|
||||
|
||||
pub(crate) const WORKSPACE_TABLE: &'static str = "workspace_table";
|
||||
|
@ -3,7 +3,7 @@ use actix_web::{
|
||||
HttpResponse,
|
||||
};
|
||||
use flowy_net::errors::{invalid_params, ServerError};
|
||||
use flowy_workspace::protobuf::{AppIdentifier, CreateAppParams, DeleteAppParams, UpdateAppParams};
|
||||
use flowy_workspace::backend_service::{AppIdentifier, CreateAppParams, DeleteAppParams, UpdateAppParams};
|
||||
use protobuf::Message;
|
||||
use sqlx::PgPool;
|
||||
|
||||
|
@ -13,10 +13,7 @@ use flowy_net::{
|
||||
errors::{invalid_params, ServerError},
|
||||
response::FlowyResponse,
|
||||
};
|
||||
use flowy_workspace::{
|
||||
entities::trash::parser::{TrashId, TrashTypeParser},
|
||||
protobuf::TrashIdentifiers,
|
||||
};
|
||||
use flowy_workspace::{backend_service::TrashType, entities::trash::parser::TrashId, protobuf::TrashIdentifiers};
|
||||
use sqlx::PgPool;
|
||||
use uuid::Uuid;
|
||||
|
||||
@ -95,8 +92,11 @@ fn check_trash_id(id: String) -> Result<Uuid, ServerError> {
|
||||
fn make_records(identifiers: TrashIdentifiers) -> Result<Vec<(Uuid, i32)>, ServerError> {
|
||||
let mut records = vec![];
|
||||
for identifier in identifiers.items {
|
||||
let ty = TrashTypeParser::parse(identifier.ty.value()).map_err(invalid_params)?;
|
||||
records.push((check_trash_id(identifier.id.to_owned())?, ty));
|
||||
// match TrashType::from_i32(identifier.ty.value()) {
|
||||
// None => {}
|
||||
// Some(ty) => {}
|
||||
// }
|
||||
records.push((check_trash_id(identifier.id.to_owned())?, identifier.ty.value()));
|
||||
}
|
||||
Ok(records)
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ use crate::{
|
||||
};
|
||||
use ::protobuf::ProtobufEnum;
|
||||
use flowy_net::errors::ServerError;
|
||||
use flowy_workspace::protobuf::{RepeatedTrash, Trash, TrashType};
|
||||
use flowy_workspace::backend_service::{RepeatedTrash, Trash, TrashType};
|
||||
use sqlx::{postgres::PgArguments, Postgres, Row};
|
||||
use uuid::Uuid;
|
||||
|
||||
|
@ -9,7 +9,7 @@ use crate::{
|
||||
|
||||
use flowy_document::services::doc::doc_initial_string;
|
||||
use flowy_net::errors::ServerError;
|
||||
use flowy_workspace::protobuf::{App, CreateViewParams, View, ViewType, Workspace};
|
||||
use flowy_workspace::backend_service::{App, CreateViewParams, View, ViewType, Workspace};
|
||||
|
||||
pub async fn create_default_workspace(
|
||||
transaction: &mut DBTransaction<'_>,
|
||||
@ -42,8 +42,8 @@ async fn create_app(
|
||||
workspace: &Workspace,
|
||||
) -> Result<App, ServerError> {
|
||||
let (sql, args, app) = AppBuilder::new(user_id, &workspace.id)
|
||||
.name("DefaultApp")
|
||||
.desc("App created by AppFlowy")
|
||||
.name("Getting Started")
|
||||
.desc("")
|
||||
.build()?;
|
||||
|
||||
let _ = sqlx::query_with(&sql, args)
|
||||
@ -57,9 +57,9 @@ async fn create_app(
|
||||
async fn create_default_view(transaction: &mut DBTransaction<'_>, app: &App) -> Result<View, ServerError> {
|
||||
let params = CreateViewParams {
|
||||
belong_to_id: app.id.clone(),
|
||||
name: "DefaultView".to_string(),
|
||||
desc: "View created by AppFlowy".to_string(),
|
||||
thumbnail: "123.png".to_string(),
|
||||
name: "Read Me".to_string(),
|
||||
desc: "".to_string(),
|
||||
thumbnail: "".to_string(),
|
||||
view_type: ViewType::Doc,
|
||||
data: doc_initial_string(),
|
||||
unknown_fields: Default::default(),
|
||||
|
@ -29,7 +29,7 @@ dashmap = "4.0"
|
||||
#optional crate
|
||||
bincode = { version = "1.3", optional = true}
|
||||
protobuf = {version = "2.24.1", optional = true}
|
||||
tracing = { version = "0.1", optional = true}
|
||||
tracing = { version = "0.1"}
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
@ -39,4 +39,3 @@ futures-util = "0.3.15"
|
||||
default = ["use_protobuf"]
|
||||
use_serde = ["bincode"]
|
||||
use_protobuf= ["protobuf"]
|
||||
use_tracing= ["tracing"]
|
||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
flowy-dispatch = { path = "../flowy-dispatch", features = ["use_tracing"]}
|
||||
flowy-dispatch = { path = "../flowy-dispatch"}
|
||||
flowy-log = { path = "../flowy-log" }
|
||||
flowy-user = { path = "../flowy-user" }
|
||||
flowy-infra = { path = "../flowy-infra" }
|
||||
|
@ -45,4 +45,7 @@ serial_test = "0.5.1"
|
||||
|
||||
|
||||
[features]
|
||||
http_server = []
|
||||
default = ["flowy_client_sdk", "backend_service"]
|
||||
http_server = []
|
||||
flowy_client_sdk = []
|
||||
backend_service = []
|
@ -1,3 +1,3 @@
|
||||
|
||||
proto_crates = ["src/entities", "src/event.rs", "src/errors.rs", "src/notify"]
|
||||
proto_crates = ["src/entities", "src/event.rs", "src/errors.rs", "src/services/notify"]
|
||||
event_files = ["src/event.rs"]
|
@ -55,18 +55,26 @@ impl TryInto<CreateAppParams> for CreateAppRequest {
|
||||
|
||||
let id = WorkspaceId::parse(self.workspace_id).map_err(|e| WorkspaceError::workspace_id().context(e))?;
|
||||
|
||||
let color_style =
|
||||
AppColorStyle::parse(self.color_style).map_err(|e| WorkspaceError::color_style().context(e))?;
|
||||
let color_style = AppColorStyle::parse(self.color_style.theme_color.clone())
|
||||
.map_err(|e| WorkspaceError::color_style().context(e))?;
|
||||
|
||||
Ok(CreateAppParams {
|
||||
workspace_id: id.0,
|
||||
name: name.0,
|
||||
desc: self.desc,
|
||||
color_style: color_style.0,
|
||||
color_style: color_style.into(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::From<AppColorStyle> for ColorStyle {
|
||||
fn from(data: AppColorStyle) -> Self {
|
||||
ColorStyle {
|
||||
theme_color: data.theme_color,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, ProtoBuf, Default, Debug, Clone)]
|
||||
pub struct App {
|
||||
#[pb(index = 1)]
|
||||
|
@ -88,9 +88,9 @@ impl TryInto<UpdateAppParams> for UpdateAppRequest {
|
||||
let color_style = match self.color_style {
|
||||
None => None,
|
||||
Some(color_style) => Some(
|
||||
AppColorStyle::parse(color_style)
|
||||
AppColorStyle::parse(color_style.theme_color.clone())
|
||||
.map_err(|e| WorkspaceError::color_style().context(e))?
|
||||
.0,
|
||||
.into(),
|
||||
),
|
||||
};
|
||||
|
||||
|
@ -1,9 +1,15 @@
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
mod app_create;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
mod app_query;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
mod app_update;
|
||||
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub use app_create::*;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub use app_query::*;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub use app_update::*;
|
||||
|
||||
mod app_create;
|
||||
mod app_query;
|
||||
mod app_update;
|
||||
pub mod parser;
|
||||
|
||||
pub use app_query::*;
|
||||
|
@ -1,15 +1,11 @@
|
||||
use crate::entities::app::ColorStyle;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct AppColorStyle(pub ColorStyle);
|
||||
pub struct AppColorStyle {
|
||||
pub theme_color: String,
|
||||
}
|
||||
|
||||
impl AppColorStyle {
|
||||
pub fn parse(color_style: ColorStyle) -> Result<AppColorStyle, String> {
|
||||
pub fn parse(theme_color: String) -> Result<AppColorStyle, String> {
|
||||
// TODO: verify the color style format
|
||||
Ok(Self(color_style))
|
||||
Ok(AppColorStyle { theme_color })
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<ColorStyle> for AppColorStyle {
|
||||
fn as_ref(&self) -> &ColorStyle { &self.0 }
|
||||
}
|
||||
|
@ -2,3 +2,7 @@ pub mod app;
|
||||
pub mod trash;
|
||||
pub mod view;
|
||||
pub mod workspace;
|
||||
|
||||
pub mod parser {
|
||||
pub use crate::entities::{app::parser::*, trash::parser::*, view::parser::*, workspace::parser::*};
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
pub mod parser;
|
||||
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
mod trash_create;
|
||||
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub use trash_create::*;
|
||||
|
@ -1,5 +1,3 @@
|
||||
mod trash_id;
|
||||
mod trash_ty;
|
||||
|
||||
pub use trash_id::*;
|
||||
pub use trash_ty::*;
|
||||
|
@ -1,16 +0,0 @@
|
||||
use crate::entities::trash::TrashType;
|
||||
use std::convert::TryFrom;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct TrashTypeParser(pub i32);
|
||||
|
||||
impl TrashTypeParser {
|
||||
pub fn parse(value: i32) -> Result<i32, String> {
|
||||
let _ = TrashType::try_from(value)?;
|
||||
Ok(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<i32> for TrashTypeParser {
|
||||
fn as_ref(&self) -> &i32 { &self.0 }
|
||||
}
|
@ -1,8 +1,14 @@
|
||||
pub mod parser;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
mod view_create;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
mod view_query;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
mod view_update;
|
||||
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub use view_create::*;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub use view_query::*;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub use view_update::*;
|
||||
|
@ -1,13 +1,23 @@
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub use workspace_create::*;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub use workspace_delete::*;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub use workspace_query::*;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub use workspace_update::*;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub use workspace_user_detail::*;
|
||||
|
||||
pub mod parser;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
mod workspace_create;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
mod workspace_delete;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
mod workspace_query;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
mod workspace_update;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
mod workspace_user_detail;
|
||||
|
||||
pub use workspace_delete::*;
|
||||
pub mod parser;
|
||||
|
@ -1,13 +1,11 @@
|
||||
mod handlers;
|
||||
mod notify;
|
||||
mod services;
|
||||
mod sql_tables;
|
||||
|
||||
pub mod entities;
|
||||
pub mod errors;
|
||||
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub mod event;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub mod module;
|
||||
pub mod protobuf;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
mod services;
|
||||
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
@ -15,9 +13,10 @@ mod macros;
|
||||
#[macro_use]
|
||||
extern crate flowy_database;
|
||||
|
||||
// #[macro_use]
|
||||
// extern crate flowy_dispatch;
|
||||
pub mod errors;
|
||||
pub mod protobuf;
|
||||
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub mod prelude {
|
||||
pub use crate::{
|
||||
entities::{app::*, trash::*, view::*, workspace::*},
|
||||
@ -26,3 +25,8 @@ pub mod prelude {
|
||||
services::*,
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(feature = "backend_service")]
|
||||
pub mod backend_service {
|
||||
pub use crate::protobuf::*;
|
||||
}
|
||||
|
@ -1,17 +1,23 @@
|
||||
use crate::{
|
||||
errors::WorkspaceError,
|
||||
event::WorkspaceEvent,
|
||||
handlers::*,
|
||||
services::{server::construct_workspace_server, AppController, ViewController, WorkspaceController},
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::services::TrashCan;
|
||||
use flowy_database::DBConnection;
|
||||
use flowy_dispatch::prelude::*;
|
||||
use flowy_document::module::FlowyDocument;
|
||||
use flowy_net::config::ServerConfig;
|
||||
use flowy_sqlite::ConnectionPool;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::{
|
||||
errors::WorkspaceError,
|
||||
event::WorkspaceEvent,
|
||||
services::{
|
||||
handlers::*,
|
||||
server::construct_workspace_server,
|
||||
AppController,
|
||||
TrashCan,
|
||||
ViewController,
|
||||
WorkspaceController,
|
||||
},
|
||||
};
|
||||
|
||||
pub trait WorkspaceDeps: WorkspaceUser + WorkspaceDatabase {}
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
use std::{collections::HashSet, sync::Arc};
|
||||
|
||||
use futures::{FutureExt, StreamExt};
|
||||
|
||||
use flowy_database::SqliteConnection;
|
||||
|
||||
use crate::{
|
||||
entities::{
|
||||
app::{App, CreateAppParams, *},
|
||||
@ -5,13 +11,15 @@ use crate::{
|
||||
},
|
||||
errors::*,
|
||||
module::{WorkspaceDatabase, WorkspaceUser},
|
||||
notify::*,
|
||||
services::{helper::spawn, server::Server, TrashCan, TrashEvent},
|
||||
sql_tables::app::{AppTable, AppTableChangeset, AppTableSql},
|
||||
services::{
|
||||
helper::spawn,
|
||||
notify::*,
|
||||
server::Server,
|
||||
sql_tables::app::{AppTable, AppTableChangeset, AppTableSql},
|
||||
TrashCan,
|
||||
TrashEvent,
|
||||
},
|
||||
};
|
||||
use flowy_database::SqliteConnection;
|
||||
use futures::{FutureExt, StreamExt};
|
||||
use std::{collections::HashSet, sync::Arc};
|
||||
|
||||
pub(crate) struct AppController {
|
||||
user: Arc<dyn WorkspaceUser>,
|
||||
|
@ -5,8 +5,14 @@ pub use workspace_controller::*;
|
||||
|
||||
mod app_controller;
|
||||
mod database;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
pub mod handlers;
|
||||
mod helper;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
mod notify;
|
||||
pub mod server;
|
||||
#[cfg(feature = "flowy_client_sdk")]
|
||||
mod sql_tables;
|
||||
mod trash_can;
|
||||
mod util;
|
||||
mod view_controller;
|
||||
|
@ -1,14 +1,17 @@
|
||||
use lazy_static::lazy_static;
|
||||
use std::sync::Arc;
|
||||
lazy_static! {
|
||||
pub(crate) static ref MIDDLEWARE: Arc<WorkspaceMiddleware> = Arc::new(WorkspaceMiddleware {});
|
||||
}
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
use flowy_net::{request::ResponseMiddleware, response::FlowyResponse};
|
||||
|
||||
use crate::{
|
||||
errors::{ErrorCode, WorkspaceError},
|
||||
notify::*,
|
||||
services::notify::*,
|
||||
};
|
||||
use flowy_net::{request::ResponseMiddleware, response::FlowyResponse};
|
||||
|
||||
lazy_static! {
|
||||
pub(crate) static ref MIDDLEWARE: Arc<WorkspaceMiddleware> = Arc::new(WorkspaceMiddleware {});
|
||||
}
|
||||
|
||||
pub(crate) struct WorkspaceMiddleware {}
|
||||
impl ResponseMiddleware for WorkspaceMiddleware {
|
||||
|
@ -1,13 +1,14 @@
|
||||
use crate::{
|
||||
errors::WorkspaceError,
|
||||
sql_tables::app::{AppTable, AppTableChangeset},
|
||||
};
|
||||
use flowy_database::{
|
||||
prelude::*,
|
||||
schema::{app_table, app_table::dsl},
|
||||
SqliteConnection,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
errors::WorkspaceError,
|
||||
services::sql_tables::app::{AppTable, AppTableChangeset},
|
||||
};
|
||||
|
||||
pub struct AppTableSql {}
|
||||
|
||||
impl AppTableSql {
|
@ -1,16 +1,18 @@
|
||||
use std::convert::TryInto;
|
||||
|
||||
use diesel::sql_types::Binary;
|
||||
use serde::{Deserialize, Serialize, __private::TryFrom};
|
||||
|
||||
use flowy_database::schema::app_table;
|
||||
|
||||
use crate::{
|
||||
entities::{
|
||||
app::{App, ColorStyle, UpdateAppParams},
|
||||
trash::{Trash, TrashType},
|
||||
view::RepeatedView,
|
||||
},
|
||||
sql_tables::workspace::WorkspaceTable,
|
||||
services::sql_tables::workspace::WorkspaceTable,
|
||||
};
|
||||
use diesel::sql_types::Binary;
|
||||
use flowy_database::schema::app_table;
|
||||
|
||||
use crate::entities::trash::{Trash, TrashType};
|
||||
use serde::{Deserialize, Serialize, __private::TryFrom};
|
||||
use std::convert::TryInto;
|
||||
|
||||
#[derive(PartialEq, Clone, Debug, Queryable, Identifiable, Insertable, Associations)]
|
||||
#[belongs_to(WorkspaceTable, foreign_key = "workspace_id")]
|
@ -1,16 +1,15 @@
|
||||
use crate::{
|
||||
entities::trash::RepeatedTrash,
|
||||
errors::WorkspaceError,
|
||||
sql_tables::trash::{TrashTable, TrashTableChangeset},
|
||||
};
|
||||
|
||||
use crate::entities::trash::Trash;
|
||||
use flowy_database::{
|
||||
prelude::*,
|
||||
schema::{trash_table, trash_table::dsl},
|
||||
SqliteConnection,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
entities::trash::{RepeatedTrash, Trash},
|
||||
errors::WorkspaceError,
|
||||
services::sql_tables::trash::{TrashTable, TrashTableChangeset},
|
||||
};
|
||||
|
||||
pub struct TrashTableSql {}
|
||||
|
||||
impl TrashTableSql {
|
@ -1,13 +1,14 @@
|
||||
use crate::{
|
||||
errors::WorkspaceError,
|
||||
sql_tables::view::{ViewTable, ViewTableChangeset},
|
||||
};
|
||||
use flowy_database::{
|
||||
prelude::*,
|
||||
schema::{view_table, view_table::dsl},
|
||||
SqliteConnection,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
errors::WorkspaceError,
|
||||
services::sql_tables::view::{ViewTable, ViewTableChangeset},
|
||||
};
|
||||
|
||||
pub struct ViewTableSql {}
|
||||
|
||||
impl ViewTableSql {
|
@ -1,13 +1,15 @@
|
||||
use diesel::sql_types::Integer;
|
||||
|
||||
use flowy_database::schema::view_table;
|
||||
use flowy_infra::timestamp;
|
||||
|
||||
use crate::{
|
||||
entities::{
|
||||
trash::{Trash, TrashType},
|
||||
view::{RepeatedView, UpdateViewParams, View, ViewType},
|
||||
},
|
||||
sql_tables::app::AppTable,
|
||||
services::sql_tables::app::AppTable,
|
||||
};
|
||||
use diesel::sql_types::Integer;
|
||||
use flowy_database::schema::view_table;
|
||||
use flowy_infra::timestamp;
|
||||
|
||||
#[derive(PartialEq, Clone, Debug, Queryable, Identifiable, Insertable, Associations)]
|
||||
#[belongs_to(AppTable, foreign_key = "belong_to_id")]
|
@ -1,13 +1,15 @@
|
||||
use crate::{
|
||||
errors::WorkspaceError,
|
||||
sql_tables::workspace::{WorkspaceTable, WorkspaceTableChangeset},
|
||||
};
|
||||
use diesel::SqliteConnection;
|
||||
|
||||
use flowy_database::{
|
||||
prelude::*,
|
||||
schema::{workspace_table, workspace_table::dsl},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
errors::WorkspaceError,
|
||||
services::sql_tables::workspace::{WorkspaceTable, WorkspaceTableChangeset},
|
||||
};
|
||||
|
||||
pub(crate) struct WorkspaceTableSql {}
|
||||
|
||||
impl WorkspaceTableSql {
|
@ -1,16 +1,21 @@
|
||||
use std::{fmt::Formatter, sync::Arc};
|
||||
|
||||
use crossbeam_utils::thread;
|
||||
use tokio::sync::{broadcast, mpsc};
|
||||
|
||||
use flowy_database::SqliteConnection;
|
||||
|
||||
use crate::{
|
||||
entities::trash::{RepeatedTrash, Trash, TrashIdentifier, TrashIdentifiers, TrashType},
|
||||
errors::{WorkspaceError, WorkspaceResult},
|
||||
module::{WorkspaceDatabase, WorkspaceUser},
|
||||
notify::{send_anonymous_dart_notification, WorkspaceNotification},
|
||||
services::{helper::spawn, server::Server},
|
||||
sql_tables::trash::TrashTableSql,
|
||||
services::{
|
||||
helper::spawn,
|
||||
notify::{send_anonymous_dart_notification, WorkspaceNotification},
|
||||
server::Server,
|
||||
sql_tables::trash::TrashTableSql,
|
||||
},
|
||||
};
|
||||
use crossbeam_utils::thread;
|
||||
use flowy_database::SqliteConnection;
|
||||
|
||||
use std::{fmt::Formatter, sync::Arc};
|
||||
use tokio::sync::{broadcast, mpsc};
|
||||
|
||||
pub struct TrashCan {
|
||||
pub database: Arc<dyn WorkspaceDatabase>,
|
||||
|
@ -1,30 +1,29 @@
|
||||
use crate::{
|
||||
entities::view::{CreateViewParams, UpdateViewParams, View},
|
||||
errors::WorkspaceError,
|
||||
module::WorkspaceDatabase,
|
||||
notify::send_dart_notification,
|
||||
services::{helper::spawn, server::Server},
|
||||
sql_tables::view::{ViewTable, ViewTableChangeset, ViewTableSql},
|
||||
};
|
||||
use std::{collections::HashSet, sync::Arc};
|
||||
|
||||
use futures::{FutureExt, StreamExt};
|
||||
|
||||
use crate::{
|
||||
entities::view::{RepeatedView, ViewIdentifier},
|
||||
errors::internal_error,
|
||||
module::WorkspaceUser,
|
||||
notify::WorkspaceNotification,
|
||||
services::{TrashCan, TrashEvent},
|
||||
};
|
||||
use flowy_database::SqliteConnection;
|
||||
use flowy_document::{
|
||||
entities::doc::{DocDelta, DocIdentifier},
|
||||
module::FlowyDocument,
|
||||
};
|
||||
|
||||
use crate::{entities::trash::TrashType, errors::WorkspaceResult};
|
||||
|
||||
use crate::entities::trash::TrashIdentifiers;
|
||||
use futures::{FutureExt, StreamExt};
|
||||
use std::{collections::HashSet, sync::Arc};
|
||||
use crate::{
|
||||
entities::{
|
||||
trash::{TrashIdentifiers, TrashType},
|
||||
view::{CreateViewParams, RepeatedView, UpdateViewParams, View, ViewIdentifier},
|
||||
},
|
||||
errors::{internal_error, WorkspaceError, WorkspaceResult},
|
||||
module::{WorkspaceDatabase, WorkspaceUser},
|
||||
services::{
|
||||
helper::spawn,
|
||||
notify::{send_dart_notification, WorkspaceNotification},
|
||||
server::Server,
|
||||
sql_tables::view::{ViewTable, ViewTableChangeset, ViewTableSql},
|
||||
TrashCan,
|
||||
TrashEvent,
|
||||
},
|
||||
};
|
||||
|
||||
pub(crate) struct ViewController {
|
||||
user: Arc<dyn WorkspaceUser>,
|
||||
|
@ -1,14 +1,23 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use flowy_database::SqliteConnection;
|
||||
use flowy_infra::kv::KV;
|
||||
|
||||
use crate::{
|
||||
entities::{app::RepeatedApp, workspace::*},
|
||||
errors::*,
|
||||
module::{WorkspaceDatabase, WorkspaceUser},
|
||||
notify::*,
|
||||
services::{helper::spawn, read_local_workspace_apps, server::Server, AppController, TrashCan, ViewController},
|
||||
sql_tables::workspace::{WorkspaceTable, WorkspaceTableChangeset, WorkspaceTableSql},
|
||||
services::{
|
||||
helper::spawn,
|
||||
notify::*,
|
||||
read_local_workspace_apps,
|
||||
server::Server,
|
||||
sql_tables::workspace::{WorkspaceTable, WorkspaceTableChangeset, WorkspaceTableSql},
|
||||
AppController,
|
||||
TrashCan,
|
||||
ViewController,
|
||||
},
|
||||
};
|
||||
use flowy_database::SqliteConnection;
|
||||
use flowy_infra::kv::KV;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct WorkspaceController {
|
||||
pub user: Arc<dyn WorkspaceUser>,
|
||||
|
Loading…
Reference in New Issue
Block a user