chore: remove unuse crates

This commit is contained in:
appflowy
2022-03-19 16:23:34 +08:00
parent 27628cc78e
commit b1d87d95cf
26 changed files with 71 additions and 191 deletions

View File

@ -17,7 +17,6 @@ flowy-database = { path = "../flowy-database" }
flowy-error = { path = "../flowy-error", features = ["db", "http_server"]}
dart-notify = { path = "../dart-notify" }
lib-dispatch = { path = "../lib-dispatch" }
lib-sqlite = { path = "../lib-sqlite" }
flowy-sync = { path = "../flowy-sync" }
parking_lot = "0.11"
@ -25,9 +24,6 @@ protobuf = {version = "2.18.0"}
log = "0.4.14"
diesel = {version = "1.4.8", features = ["sqlite"]}
diesel_derives = {version = "1.4.1", features = ["sqlite"]}
#diesel = { git = "https://github.com/diesel-rs/diesel.git", branch = "master", features = ["sqlite"] }
#diesel_derives = { git = "https://github.com/diesel-rs/diesel.git", branch = "master",features = ["sqlite"] }
futures-core = { version = "0.3", default-features = false }
futures = "0.3.15"
pin-project = "1.0.0"
strum = "0.21"
@ -35,17 +31,10 @@ strum_macros = "0.21"
tokio = { version = "1", features = ["rt"] }
lazy_static = "1.4.0"
serde = { version = "1.0", features = ["derive"] }
derive_more = {version = "0.99", features = ["display"]}
bincode = { version = "1.3"}
tracing = { version = "0.1", features = ["log"] }
bytes = { version = "1.0" }
crossbeam = "0.8"
crossbeam-utils = "0.8"
chrono = "0.4"
dashmap = "4.0"
[dev-dependencies]
serial_test = "0.5.1"
serde_json = "1.0"
flowy-folder = { path = "../flowy-folder", features = ["flowy_unit_test"]}
flowy-test = { path = "../flowy-test" }

View File

@ -9,14 +9,12 @@ use crate::{
manager::FolderManager,
services::{app::event_handler::*, trash::event_handler::*, view::event_handler::*, workspace::event_handler::*},
};
use flowy_database::DBConnection;
use flowy_database::{ConnectionPool, DBConnection};
use flowy_derive::{Flowy_Event, ProtoBuf_Enum};
use strum_macros::Display;
use lib_dispatch::prelude::*;
use lib_infra::future::FutureResult;
use lib_sqlite::ConnectionPool;
use std::sync::Arc;
use strum_macros::Display;
pub trait WorkspaceDeps: WorkspaceUser + WorkspaceDatabase {}

View File

@ -9,8 +9,6 @@ use crate::{
},
};
use bytes::Bytes;
use chrono::Utc;
use flowy_collaboration::client_document::default::{initial_quill_delta_string, initial_read_me};
use flowy_collaboration::{client_folder::FolderPad, entities::ws_data::ServerRevisionWSData};
@ -202,8 +200,7 @@ impl DefaultFolderBuilder {
view_controller: Arc<ViewController>,
) -> FlowyResult<()> {
log::debug!("Create user default workspace");
let time = Utc::now();
let workspace = user_default::create_default_workspace(time);
let workspace = user_default::create_default_workspace();
set_current_workspace(&workspace.id);
for app in workspace.apps.iter() {
for (index, view) in app.belongings.iter().enumerate() {

View File

@ -9,6 +9,7 @@ use crate::{
};
use flowy_collaboration::client_folder::initial_folder_delta;
use flowy_collaboration::{client_folder::FolderPad, entities::revision::Revision};
use flowy_database::ConnectionPool;
use flowy_error::{FlowyError, FlowyResult};
use flowy_folder_data_model::entities::{
app::App,
@ -18,7 +19,6 @@ use flowy_folder_data_model::entities::{
};
use flowy_sync::disk::{RevisionRecord, RevisionState};
use flowy_sync::mk_revision_disk_cache;
use lib_sqlite::ConnectionPool;
use std::sync::Arc;
use tokio::sync::RwLock;
pub use version_1::{app_sql::*, trash_sql::*, v1_impl::V1Transaction, view_sql::*, workspace_sql::*};

View File

@ -1,18 +1,14 @@
use crate::entities::{
app::{App, ColorStyle, UpdateAppParams},
app::{App, UpdateAppParams},
trash::{Trash, TrashType},
view::RepeatedView,
};
use diesel::sql_types::Binary;
use crate::{errors::FlowyError, services::persistence::version_1::workspace_sql::WorkspaceTable};
use flowy_database::{
prelude::*,
schema::{app_table, app_table::dsl},
SqliteConnection,
};
use serde::{Deserialize, Serialize, __private::TryFrom};
use std::convert::TryInto;
use crate::{errors::FlowyError, services::persistence::version_1::workspace_sql::WorkspaceTable};
pub struct AppTableSql();
impl AppTableSql {
@ -86,7 +82,7 @@ pub(crate) struct AppTable {
pub workspace_id: String, // equal to #[belongs_to(Workspace, foreign_key = "workspace_id")].
pub name: String,
pub desc: String,
pub color_style: ColorStyleCol,
pub color_style: Vec<u8>,
pub last_view_id: Option<String>,
pub modified_time: i64,
pub create_time: i64,
@ -101,7 +97,7 @@ impl AppTable {
workspace_id: app.workspace_id,
name: app.name,
desc: app.desc,
color_style: ColorStyleCol::default(),
color_style: Default::default(),
last_view_id: None,
modified_time: app.modified_time,
create_time: app.create_time,
@ -123,38 +119,6 @@ impl std::convert::From<AppTable> for Trash {
}
}
#[derive(Clone, PartialEq, Serialize, Deserialize, Debug, Default, FromSqlRow, AsExpression)]
#[sql_type = "Binary"]
pub(crate) struct ColorStyleCol {
pub(crate) theme_color: String,
}
impl std::convert::From<ColorStyle> for ColorStyleCol {
fn from(s: ColorStyle) -> Self {
Self {
theme_color: s.theme_color,
}
}
}
impl std::convert::TryInto<Vec<u8>> for &ColorStyleCol {
type Error = String;
fn try_into(self) -> Result<Vec<u8>, Self::Error> {
bincode::serialize(self).map_err(|e| format!("{:?}", e))
}
}
impl std::convert::TryFrom<&[u8]> for ColorStyleCol {
type Error = String;
fn try_from(value: &[u8]) -> Result<Self, Self::Error> {
bincode::deserialize(value).map_err(|e| format!("{:?}", e))
}
}
impl_sql_binary_expression!(ColorStyleCol);
#[derive(AsChangeset, Identifiable, Default, Debug)]
#[table_name = "app_table"]
pub struct AppChangeset {

View File

@ -6,6 +6,7 @@ use crate::services::persistence::{
},
FolderPersistenceTransaction, TrashTableSql,
};
use flowy_database::DBConnection;
use flowy_error::FlowyResult;
use flowy_folder_data_model::entities::{
app::App,
@ -13,7 +14,6 @@ use flowy_folder_data_model::entities::{
view::View,
workspace::Workspace,
};
use lib_sqlite::DBConnection;
pub struct V1Transaction<'a>(pub &'a DBConnection);