mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-24 22:57:12 -04:00
chore: remove unuse crates
This commit is contained in:
parent
27628cc78e
commit
b1d87d95cf
26 changed files with 71 additions and 191 deletions
|
@ -13,6 +13,7 @@ class ErrorCode extends $pb.ProtobufEnum {
|
||||||
static const ErrorCode Internal = ErrorCode._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Internal');
|
static const ErrorCode Internal = ErrorCode._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Internal');
|
||||||
static const ErrorCode UserUnauthorized = ErrorCode._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UserUnauthorized');
|
static const ErrorCode UserUnauthorized = ErrorCode._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UserUnauthorized');
|
||||||
static const ErrorCode RecordNotFound = ErrorCode._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'RecordNotFound');
|
static const ErrorCode RecordNotFound = ErrorCode._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'RecordNotFound');
|
||||||
|
static const ErrorCode UserIdIsEmpty = ErrorCode._(4, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UserIdIsEmpty');
|
||||||
static const ErrorCode WorkspaceNameInvalid = ErrorCode._(100, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'WorkspaceNameInvalid');
|
static const ErrorCode WorkspaceNameInvalid = ErrorCode._(100, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'WorkspaceNameInvalid');
|
||||||
static const ErrorCode WorkspaceIdInvalid = ErrorCode._(101, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'WorkspaceIdInvalid');
|
static const ErrorCode WorkspaceIdInvalid = ErrorCode._(101, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'WorkspaceIdInvalid');
|
||||||
static const ErrorCode AppColorStyleInvalid = ErrorCode._(102, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'AppColorStyleInvalid');
|
static const ErrorCode AppColorStyleInvalid = ErrorCode._(102, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'AppColorStyleInvalid');
|
||||||
|
@ -50,6 +51,7 @@ class ErrorCode extends $pb.ProtobufEnum {
|
||||||
Internal,
|
Internal,
|
||||||
UserUnauthorized,
|
UserUnauthorized,
|
||||||
RecordNotFound,
|
RecordNotFound,
|
||||||
|
UserIdIsEmpty,
|
||||||
WorkspaceNameInvalid,
|
WorkspaceNameInvalid,
|
||||||
WorkspaceIdInvalid,
|
WorkspaceIdInvalid,
|
||||||
AppColorStyleInvalid,
|
AppColorStyleInvalid,
|
||||||
|
|
|
@ -15,6 +15,7 @@ const ErrorCode$json = const {
|
||||||
const {'1': 'Internal', '2': 0},
|
const {'1': 'Internal', '2': 0},
|
||||||
const {'1': 'UserUnauthorized', '2': 2},
|
const {'1': 'UserUnauthorized', '2': 2},
|
||||||
const {'1': 'RecordNotFound', '2': 3},
|
const {'1': 'RecordNotFound', '2': 3},
|
||||||
|
const {'1': 'UserIdIsEmpty', '2': 4},
|
||||||
const {'1': 'WorkspaceNameInvalid', '2': 100},
|
const {'1': 'WorkspaceNameInvalid', '2': 100},
|
||||||
const {'1': 'WorkspaceIdInvalid', '2': 101},
|
const {'1': 'WorkspaceIdInvalid', '2': 101},
|
||||||
const {'1': 'AppColorStyleInvalid', '2': 102},
|
const {'1': 'AppColorStyleInvalid', '2': 102},
|
||||||
|
@ -51,4 +52,4 @@ const ErrorCode$json = const {
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Descriptor for `ErrorCode`. Decode as a `google.protobuf.EnumDescriptorProto`.
|
/// Descriptor for `ErrorCode`. Decode as a `google.protobuf.EnumDescriptorProto`.
|
||||||
final $typed_data.Uint8List errorCodeDescriptor = $convert.base64Decode('CglFcnJvckNvZGUSDAoISW50ZXJuYWwQABIUChBVc2VyVW5hdXRob3JpemVkEAISEgoOUmVjb3JkTm90Rm91bmQQAxIYChRXb3Jrc3BhY2VOYW1lSW52YWxpZBBkEhYKEldvcmtzcGFjZUlkSW52YWxpZBBlEhgKFEFwcENvbG9yU3R5bGVJbnZhbGlkEGYSGAoUV29ya3NwYWNlRGVzY1Rvb0xvbmcQZxIYChRXb3Jrc3BhY2VOYW1lVG9vTG9uZxBoEhAKDEFwcElkSW52YWxpZBBuEhIKDkFwcE5hbWVJbnZhbGlkEG8SEwoPVmlld05hbWVJbnZhbGlkEHgSGAoUVmlld1RodW1ibmFpbEludmFsaWQQeRIRCg1WaWV3SWRJbnZhbGlkEHoSEwoPVmlld0Rlc2NUb29Mb25nEHsSEwoPVmlld0RhdGFJbnZhbGlkEHwSEwoPVmlld05hbWVUb29Mb25nEH0SEQoMQ29ubmVjdEVycm9yEMgBEhEKDEVtYWlsSXNFbXB0eRCsAhIXChJFbWFpbEZvcm1hdEludmFsaWQQrQISFwoSRW1haWxBbHJlYWR5RXhpc3RzEK4CEhQKD1Bhc3N3b3JkSXNFbXB0eRCvAhIUCg9QYXNzd29yZFRvb0xvbmcQsAISJQogUGFzc3dvcmRDb250YWluc0ZvcmJpZENoYXJhY3RlcnMQsQISGgoVUGFzc3dvcmRGb3JtYXRJbnZhbGlkELICEhUKEFBhc3N3b3JkTm90TWF0Y2gQswISFAoPVXNlck5hbWVUb29Mb25nELQCEicKIlVzZXJOYW1lQ29udGFpbkZvcmJpZGRlbkNoYXJhY3RlcnMQtQISFAoPVXNlck5hbWVJc0VtcHR5ELYCEhIKDVVzZXJJZEludmFsaWQQtwISEQoMVXNlck5vdEV4aXN0ELgCEhAKC1RleHRUb29Mb25nEJADEhMKDkJsb2NrSWRJc0VtcHR5EJEDEhEKDFJvd0lkSXNFbXB0eRCSAxISCg1HcmlkSWRJc0VtcHR5EJMDEhAKC0ludmFsaWREYXRhEJQD');
|
final $typed_data.Uint8List errorCodeDescriptor = $convert.base64Decode('CglFcnJvckNvZGUSDAoISW50ZXJuYWwQABIUChBVc2VyVW5hdXRob3JpemVkEAISEgoOUmVjb3JkTm90Rm91bmQQAxIRCg1Vc2VySWRJc0VtcHR5EAQSGAoUV29ya3NwYWNlTmFtZUludmFsaWQQZBIWChJXb3Jrc3BhY2VJZEludmFsaWQQZRIYChRBcHBDb2xvclN0eWxlSW52YWxpZBBmEhgKFFdvcmtzcGFjZURlc2NUb29Mb25nEGcSGAoUV29ya3NwYWNlTmFtZVRvb0xvbmcQaBIQCgxBcHBJZEludmFsaWQQbhISCg5BcHBOYW1lSW52YWxpZBBvEhMKD1ZpZXdOYW1lSW52YWxpZBB4EhgKFFZpZXdUaHVtYm5haWxJbnZhbGlkEHkSEQoNVmlld0lkSW52YWxpZBB6EhMKD1ZpZXdEZXNjVG9vTG9uZxB7EhMKD1ZpZXdEYXRhSW52YWxpZBB8EhMKD1ZpZXdOYW1lVG9vTG9uZxB9EhEKDENvbm5lY3RFcnJvchDIARIRCgxFbWFpbElzRW1wdHkQrAISFwoSRW1haWxGb3JtYXRJbnZhbGlkEK0CEhcKEkVtYWlsQWxyZWFkeUV4aXN0cxCuAhIUCg9QYXNzd29yZElzRW1wdHkQrwISFAoPUGFzc3dvcmRUb29Mb25nELACEiUKIFBhc3N3b3JkQ29udGFpbnNGb3JiaWRDaGFyYWN0ZXJzELECEhoKFVBhc3N3b3JkRm9ybWF0SW52YWxpZBCyAhIVChBQYXNzd29yZE5vdE1hdGNoELMCEhQKD1VzZXJOYW1lVG9vTG9uZxC0AhInCiJVc2VyTmFtZUNvbnRhaW5Gb3JiaWRkZW5DaGFyYWN0ZXJzELUCEhQKD1VzZXJOYW1lSXNFbXB0eRC2AhISCg1Vc2VySWRJbnZhbGlkELcCEhEKDFVzZXJOb3RFeGlzdBC4AhIQCgtUZXh0VG9vTG9uZxCQAxITCg5CbG9ja0lkSXNFbXB0eRCRAxIRCgxSb3dJZElzRW1wdHkQkgMSEgoNR3JpZElkSXNFbXB0eRCTAxIQCgtJbnZhbGlkRGF0YRCUAw==');
|
||||||
|
|
|
@ -1322,7 +1322,7 @@ packages:
|
||||||
path: "plugins/window_size"
|
path: "plugins/window_size"
|
||||||
ref: e48abe7c3e9ebfe0b81622167c5201d4e783bb81
|
ref: e48abe7c3e9ebfe0b81622167c5201d4e783bb81
|
||||||
resolved-ref: e48abe7c3e9ebfe0b81622167c5201d4e783bb81
|
resolved-ref: e48abe7c3e9ebfe0b81622167c5201d4e783bb81
|
||||||
url: "git://github.com/google/flutter-desktop-embedding.git"
|
url: "https://github.com/google/flutter-desktop-embedding.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.1.0"
|
version: "0.1.0"
|
||||||
xdg_directories:
|
xdg_directories:
|
||||||
|
|
64
frontend/rust-lib/Cargo.lock
generated
64
frontend/rust-lib/Cargo.lock
generated
|
@ -84,17 +84,6 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "async-trait"
|
|
||||||
version = "0.1.52"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "atomic"
|
name = "atomic"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
|
@ -464,20 +453,6 @@ dependencies = [
|
||||||
"itertools",
|
"itertools",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crossbeam"
|
|
||||||
version = "0.8.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4ae5588f6b3c3cb05239e90bd110f257254aecd01e4635400391aeae07497845"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"crossbeam-channel",
|
|
||||||
"crossbeam-deque",
|
|
||||||
"crossbeam-epoch",
|
|
||||||
"crossbeam-queue",
|
|
||||||
"crossbeam-utils",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-channel"
|
name = "crossbeam-channel"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
|
@ -512,16 +487,6 @@ dependencies = [
|
||||||
"scopeguard",
|
"scopeguard",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crossbeam-queue"
|
|
||||||
version = "0.3.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b979d76c9fcb84dffc80a73f7290da0f83e4c95773494674cb44b76d13a7a110"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"crossbeam-utils",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-utils"
|
name = "crossbeam-utils"
|
||||||
version = "0.8.6"
|
version = "0.8.6"
|
||||||
|
@ -858,9 +823,6 @@ name = "flowy-block"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-stream",
|
"async-stream",
|
||||||
"async-trait",
|
|
||||||
"bytecount",
|
|
||||||
"byteorder",
|
|
||||||
"bytes",
|
"bytes",
|
||||||
"chrono",
|
"chrono",
|
||||||
"color-eyre",
|
"color-eyre",
|
||||||
|
@ -884,8 +846,6 @@ dependencies = [
|
||||||
"lib-ot",
|
"lib-ot",
|
||||||
"lib-ws",
|
"lib-ws",
|
||||||
"log",
|
"log",
|
||||||
"parking_lot",
|
|
||||||
"pin-project",
|
|
||||||
"protobuf",
|
"protobuf",
|
||||||
"rand 0.7.3",
|
"rand 0.7.3",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -986,14 +946,8 @@ dependencies = [
|
||||||
name = "flowy-folder"
|
name = "flowy-folder"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
|
||||||
"bytes",
|
"bytes",
|
||||||
"chrono",
|
|
||||||
"crossbeam",
|
|
||||||
"crossbeam-utils",
|
|
||||||
"dart-notify",
|
"dart-notify",
|
||||||
"dashmap",
|
|
||||||
"derive_more",
|
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel_derives",
|
"diesel_derives",
|
||||||
"flowy-block",
|
"flowy-block",
|
||||||
|
@ -1006,19 +960,16 @@ dependencies = [
|
||||||
"flowy-sync",
|
"flowy-sync",
|
||||||
"flowy-test",
|
"flowy-test",
|
||||||
"futures",
|
"futures",
|
||||||
"futures-core",
|
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lib-dispatch",
|
"lib-dispatch",
|
||||||
"lib-infra",
|
"lib-infra",
|
||||||
"lib-ot",
|
"lib-ot",
|
||||||
"lib-sqlite",
|
|
||||||
"log",
|
"log",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"pin-project",
|
"pin-project",
|
||||||
"protobuf",
|
"protobuf",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serial_test",
|
|
||||||
"strum",
|
"strum",
|
||||||
"strum_macros",
|
"strum_macros",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
@ -1067,8 +1018,6 @@ dependencies = [
|
||||||
"lib-dispatch",
|
"lib-dispatch",
|
||||||
"lib-infra",
|
"lib-infra",
|
||||||
"lib-ot",
|
"lib-ot",
|
||||||
"lib-sqlite",
|
|
||||||
"parking_lot",
|
|
||||||
"protobuf",
|
"protobuf",
|
||||||
"rayon",
|
"rayon",
|
||||||
"rust_decimal",
|
"rust_decimal",
|
||||||
|
@ -1171,7 +1120,6 @@ name = "flowy-sync"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-stream",
|
"async-stream",
|
||||||
"async-trait",
|
|
||||||
"bytes",
|
"bytes",
|
||||||
"dashmap",
|
"dashmap",
|
||||||
"diesel",
|
"diesel",
|
||||||
|
@ -1183,10 +1131,7 @@ dependencies = [
|
||||||
"lib-infra",
|
"lib-infra",
|
||||||
"lib-ot",
|
"lib-ot",
|
||||||
"lib-ws",
|
"lib-ws",
|
||||||
"parking_lot",
|
|
||||||
"protobuf",
|
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
|
||||||
"strum",
|
"strum",
|
||||||
"strum_macros",
|
"strum_macros",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
@ -1229,8 +1174,6 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"dart-notify",
|
"dart-notify",
|
||||||
"dashmap",
|
|
||||||
"derive_more",
|
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel_derives",
|
"diesel_derives",
|
||||||
"flowy-database",
|
"flowy-database",
|
||||||
|
@ -1239,24 +1182,17 @@ dependencies = [
|
||||||
"flowy-test",
|
"flowy-test",
|
||||||
"flowy-user-data-model",
|
"flowy-user-data-model",
|
||||||
"futures",
|
"futures",
|
||||||
"futures-core",
|
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lib-dispatch",
|
"lib-dispatch",
|
||||||
"lib-infra",
|
"lib-infra",
|
||||||
"lib-sqlite",
|
|
||||||
"log",
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"pin-project",
|
|
||||||
"protobuf",
|
"protobuf",
|
||||||
"r2d2",
|
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serial_test",
|
|
||||||
"strum",
|
"strum",
|
||||||
"strum_macros",
|
"strum_macros",
|
||||||
"thread-id",
|
|
||||||
"thread_local",
|
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
|
@ -18,4 +18,15 @@ members = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
|
opt-level = 0
|
||||||
|
#https://doc.rust-lang.org/rustc/codegen-options/index.html#debug-assertions
|
||||||
split-debuginfo = "unpacked"
|
split-debuginfo = "unpacked"
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
opt-level = 3
|
||||||
|
## debuginfo — it makes ./target much bigger, which again harms caching. Depending on your preferred workflow,
|
||||||
|
## you might consider disabling debuginfo unconditionally, this brings some benefits for local builds as well.
|
||||||
|
#strip = "debuginfo"
|
||||||
|
## For from-scratch builds, incremental adds an extra dependency-tracking overhead. It also significantly increases
|
||||||
|
## the amount of IO and the size of ./target, which make caching less effective.
|
||||||
|
incremental = false
|
|
@ -13,7 +13,6 @@ lib-ot = { path = "../../../shared-lib/lib-ot" }
|
||||||
lib-ws = { path = "../../../shared-lib/lib-ws" }
|
lib-ws = { path = "../../../shared-lib/lib-ws" }
|
||||||
lib-infra = { path = "../../../shared-lib/lib-infra" }
|
lib-infra = { path = "../../../shared-lib/lib-infra" }
|
||||||
|
|
||||||
derive_more = {version = "0.99", features = ["display"]}
|
|
||||||
lib-dispatch = { path = "../lib-dispatch" }
|
lib-dispatch = { path = "../lib-dispatch" }
|
||||||
flowy-database = { path = "../flowy-database" }
|
flowy-database = { path = "../flowy-database" }
|
||||||
flowy-sync = { path = "../flowy-sync" }
|
flowy-sync = { path = "../flowy-sync" }
|
||||||
|
@ -31,22 +30,18 @@ bytes = { version = "1.1" }
|
||||||
strum = "0.21"
|
strum = "0.21"
|
||||||
strum_macros = "0.21"
|
strum_macros = "0.21"
|
||||||
dashmap = "4.0"
|
dashmap = "4.0"
|
||||||
parking_lot = "0.11"
|
|
||||||
bytecount = "0.6.0"
|
|
||||||
url = "2.2"
|
url = "2.2"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = {version = "1.0"}
|
serde_json = {version = "1.0"}
|
||||||
chrono = "0.4.19"
|
chrono = "0.4.19"
|
||||||
futures-util = "0.3.15"
|
futures-util = "0.3.15"
|
||||||
byteorder = {version = "1.3.4"}
|
|
||||||
async-stream = "0.3.2"
|
async-stream = "0.3.2"
|
||||||
async-trait = "0.1.52"
|
|
||||||
futures = "0.3.15"
|
futures = "0.3.15"
|
||||||
pin-project = "1.0.0"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
flowy-test = { path = "../flowy-test" }
|
flowy-test = { path = "../flowy-test" }
|
||||||
flowy-block = { path = "../flowy-block", features = ["flowy_unit_test"]}
|
flowy-block = { path = "../flowy-block", features = ["flowy_unit_test"]}
|
||||||
|
derive_more = {version = "0.99", features = ["display"]}
|
||||||
|
|
||||||
color-eyre = { version = "0.5", default-features = false }
|
color-eyre = { version = "0.5", default-features = false }
|
||||||
criterion = "0.3"
|
criterion = "0.3"
|
||||||
|
|
|
@ -4,7 +4,6 @@ mod op_test;
|
||||||
mod serde_test;
|
mod serde_test;
|
||||||
mod undo_redo_test;
|
mod undo_redo_test;
|
||||||
|
|
||||||
use derive_more::Display;
|
|
||||||
use flowy_collaboration::client_document::{ClientDocument, InitialDocumentText};
|
use flowy_collaboration::client_document::{ClientDocument, InitialDocumentText};
|
||||||
use lib_ot::{
|
use lib_ot::{
|
||||||
core::*,
|
core::*,
|
||||||
|
|
|
@ -17,7 +17,6 @@ flowy-database = { path = "../flowy-database" }
|
||||||
flowy-error = { path = "../flowy-error", features = ["db", "http_server"]}
|
flowy-error = { path = "../flowy-error", features = ["db", "http_server"]}
|
||||||
dart-notify = { path = "../dart-notify" }
|
dart-notify = { path = "../dart-notify" }
|
||||||
lib-dispatch = { path = "../lib-dispatch" }
|
lib-dispatch = { path = "../lib-dispatch" }
|
||||||
lib-sqlite = { path = "../lib-sqlite" }
|
|
||||||
flowy-sync = { path = "../flowy-sync" }
|
flowy-sync = { path = "../flowy-sync" }
|
||||||
|
|
||||||
parking_lot = "0.11"
|
parking_lot = "0.11"
|
||||||
|
@ -25,9 +24,6 @@ protobuf = {version = "2.18.0"}
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
diesel = {version = "1.4.8", features = ["sqlite"]}
|
diesel = {version = "1.4.8", features = ["sqlite"]}
|
||||||
diesel_derives = {version = "1.4.1", 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"
|
futures = "0.3.15"
|
||||||
pin-project = "1.0.0"
|
pin-project = "1.0.0"
|
||||||
strum = "0.21"
|
strum = "0.21"
|
||||||
|
@ -35,17 +31,10 @@ strum_macros = "0.21"
|
||||||
tokio = { version = "1", features = ["rt"] }
|
tokio = { version = "1", features = ["rt"] }
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
derive_more = {version = "0.99", features = ["display"]}
|
|
||||||
bincode = { version = "1.3"}
|
|
||||||
tracing = { version = "0.1", features = ["log"] }
|
tracing = { version = "0.1", features = ["log"] }
|
||||||
bytes = { version = "1.0" }
|
bytes = { version = "1.0" }
|
||||||
crossbeam = "0.8"
|
|
||||||
crossbeam-utils = "0.8"
|
|
||||||
chrono = "0.4"
|
|
||||||
dashmap = "4.0"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serial_test = "0.5.1"
|
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
flowy-folder = { path = "../flowy-folder", features = ["flowy_unit_test"]}
|
flowy-folder = { path = "../flowy-folder", features = ["flowy_unit_test"]}
|
||||||
flowy-test = { path = "../flowy-test" }
|
flowy-test = { path = "../flowy-test" }
|
||||||
|
|
|
@ -9,14 +9,12 @@ use crate::{
|
||||||
manager::FolderManager,
|
manager::FolderManager,
|
||||||
services::{app::event_handler::*, trash::event_handler::*, view::event_handler::*, workspace::event_handler::*},
|
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 flowy_derive::{Flowy_Event, ProtoBuf_Enum};
|
||||||
use strum_macros::Display;
|
|
||||||
|
|
||||||
use lib_dispatch::prelude::*;
|
use lib_dispatch::prelude::*;
|
||||||
use lib_infra::future::FutureResult;
|
use lib_infra::future::FutureResult;
|
||||||
use lib_sqlite::ConnectionPool;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use strum_macros::Display;
|
||||||
|
|
||||||
pub trait WorkspaceDeps: WorkspaceUser + WorkspaceDatabase {}
|
pub trait WorkspaceDeps: WorkspaceUser + WorkspaceDatabase {}
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,6 @@ use crate::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use chrono::Utc;
|
|
||||||
|
|
||||||
use flowy_collaboration::client_document::default::{initial_quill_delta_string, initial_read_me};
|
use flowy_collaboration::client_document::default::{initial_quill_delta_string, initial_read_me};
|
||||||
|
|
||||||
use flowy_collaboration::{client_folder::FolderPad, entities::ws_data::ServerRevisionWSData};
|
use flowy_collaboration::{client_folder::FolderPad, entities::ws_data::ServerRevisionWSData};
|
||||||
|
@ -202,8 +200,7 @@ impl DefaultFolderBuilder {
|
||||||
view_controller: Arc<ViewController>,
|
view_controller: Arc<ViewController>,
|
||||||
) -> FlowyResult<()> {
|
) -> FlowyResult<()> {
|
||||||
log::debug!("Create user default workspace");
|
log::debug!("Create user default workspace");
|
||||||
let time = Utc::now();
|
let workspace = user_default::create_default_workspace();
|
||||||
let workspace = user_default::create_default_workspace(time);
|
|
||||||
set_current_workspace(&workspace.id);
|
set_current_workspace(&workspace.id);
|
||||||
for app in workspace.apps.iter() {
|
for app in workspace.apps.iter() {
|
||||||
for (index, view) in app.belongings.iter().enumerate() {
|
for (index, view) in app.belongings.iter().enumerate() {
|
||||||
|
|
|
@ -9,6 +9,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
use flowy_collaboration::client_folder::initial_folder_delta;
|
use flowy_collaboration::client_folder::initial_folder_delta;
|
||||||
use flowy_collaboration::{client_folder::FolderPad, entities::revision::Revision};
|
use flowy_collaboration::{client_folder::FolderPad, entities::revision::Revision};
|
||||||
|
use flowy_database::ConnectionPool;
|
||||||
use flowy_error::{FlowyError, FlowyResult};
|
use flowy_error::{FlowyError, FlowyResult};
|
||||||
use flowy_folder_data_model::entities::{
|
use flowy_folder_data_model::entities::{
|
||||||
app::App,
|
app::App,
|
||||||
|
@ -18,7 +19,6 @@ use flowy_folder_data_model::entities::{
|
||||||
};
|
};
|
||||||
use flowy_sync::disk::{RevisionRecord, RevisionState};
|
use flowy_sync::disk::{RevisionRecord, RevisionState};
|
||||||
use flowy_sync::mk_revision_disk_cache;
|
use flowy_sync::mk_revision_disk_cache;
|
||||||
use lib_sqlite::ConnectionPool;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
pub use version_1::{app_sql::*, trash_sql::*, v1_impl::V1Transaction, view_sql::*, workspace_sql::*};
|
pub use version_1::{app_sql::*, trash_sql::*, v1_impl::V1Transaction, view_sql::*, workspace_sql::*};
|
||||||
|
|
|
@ -1,18 +1,14 @@
|
||||||
use crate::entities::{
|
use crate::entities::{
|
||||||
app::{App, ColorStyle, UpdateAppParams},
|
app::{App, UpdateAppParams},
|
||||||
trash::{Trash, TrashType},
|
trash::{Trash, TrashType},
|
||||||
view::RepeatedView,
|
view::RepeatedView,
|
||||||
};
|
};
|
||||||
use diesel::sql_types::Binary;
|
use crate::{errors::FlowyError, services::persistence::version_1::workspace_sql::WorkspaceTable};
|
||||||
use flowy_database::{
|
use flowy_database::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
schema::{app_table, app_table::dsl},
|
schema::{app_table, app_table::dsl},
|
||||||
SqliteConnection,
|
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();
|
pub struct AppTableSql();
|
||||||
impl 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 workspace_id: String, // equal to #[belongs_to(Workspace, foreign_key = "workspace_id")].
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub desc: String,
|
pub desc: String,
|
||||||
pub color_style: ColorStyleCol,
|
pub color_style: Vec<u8>,
|
||||||
pub last_view_id: Option<String>,
|
pub last_view_id: Option<String>,
|
||||||
pub modified_time: i64,
|
pub modified_time: i64,
|
||||||
pub create_time: i64,
|
pub create_time: i64,
|
||||||
|
@ -101,7 +97,7 @@ impl AppTable {
|
||||||
workspace_id: app.workspace_id,
|
workspace_id: app.workspace_id,
|
||||||
name: app.name,
|
name: app.name,
|
||||||
desc: app.desc,
|
desc: app.desc,
|
||||||
color_style: ColorStyleCol::default(),
|
color_style: Default::default(),
|
||||||
last_view_id: None,
|
last_view_id: None,
|
||||||
modified_time: app.modified_time,
|
modified_time: app.modified_time,
|
||||||
create_time: app.create_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)]
|
#[derive(AsChangeset, Identifiable, Default, Debug)]
|
||||||
#[table_name = "app_table"]
|
#[table_name = "app_table"]
|
||||||
pub struct AppChangeset {
|
pub struct AppChangeset {
|
||||||
|
|
|
@ -6,6 +6,7 @@ use crate::services::persistence::{
|
||||||
},
|
},
|
||||||
FolderPersistenceTransaction, TrashTableSql,
|
FolderPersistenceTransaction, TrashTableSql,
|
||||||
};
|
};
|
||||||
|
use flowy_database::DBConnection;
|
||||||
use flowy_error::FlowyResult;
|
use flowy_error::FlowyResult;
|
||||||
use flowy_folder_data_model::entities::{
|
use flowy_folder_data_model::entities::{
|
||||||
app::App,
|
app::App,
|
||||||
|
@ -13,7 +14,6 @@ use flowy_folder_data_model::entities::{
|
||||||
view::View,
|
view::View,
|
||||||
workspace::Workspace,
|
workspace::Workspace,
|
||||||
};
|
};
|
||||||
use lib_sqlite::DBConnection;
|
|
||||||
|
|
||||||
pub struct V1Transaction<'a>(pub &'a DBConnection);
|
pub struct V1Transaction<'a>(pub &'a DBConnection);
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lib-dispatch = { path = "../lib-dispatch" }
|
lib-dispatch = { path = "../lib-dispatch" }
|
||||||
dart-notify = { path = "../dart-notify" }
|
dart-notify = { path = "../dart-notify" }
|
||||||
lib-sqlite = { path = "../lib-sqlite" }
|
|
||||||
flowy-sync = { path = "../flowy-sync" }
|
flowy-sync = { path = "../flowy-sync" }
|
||||||
flowy-error = { path = "../flowy-error", features = ["db"]}
|
flowy-error = { path = "../flowy-error", features = ["db"]}
|
||||||
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
|
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
|
||||||
|
@ -32,7 +31,6 @@ diesel = {version = "1.4.8", features = ["sqlite"]}
|
||||||
dashmap = "4.0"
|
dashmap = "4.0"
|
||||||
tokio = {version = "1", features = ["sync"]}
|
tokio = {version = "1", features = ["sync"]}
|
||||||
rayon = "1.5"
|
rayon = "1.5"
|
||||||
parking_lot = "0.11"
|
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = {version = "1.0"}
|
serde_json = {version = "1.0"}
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,13 @@ use bytes::Bytes;
|
||||||
use dashmap::DashMap;
|
use dashmap::DashMap;
|
||||||
use flowy_collaboration::client_grid::{make_block_meta_delta, make_grid_delta};
|
use flowy_collaboration::client_grid::{make_block_meta_delta, make_grid_delta};
|
||||||
use flowy_collaboration::entities::revision::{RepeatedRevision, Revision};
|
use flowy_collaboration::entities::revision::{RepeatedRevision, Revision};
|
||||||
|
use flowy_database::ConnectionPool;
|
||||||
use flowy_error::{FlowyError, FlowyResult};
|
use flowy_error::{FlowyError, FlowyResult};
|
||||||
use flowy_grid_data_model::entities::{BuildGridContext, GridMeta};
|
use flowy_grid_data_model::entities::{BuildGridContext, GridMeta};
|
||||||
use flowy_sync::disk::{SQLiteGridBlockMetaRevisionPersistence, SQLiteGridRevisionPersistence};
|
use flowy_sync::disk::{SQLiteGridBlockMetaRevisionPersistence, SQLiteGridRevisionPersistence};
|
||||||
use flowy_sync::{RevisionManager, RevisionPersistence, RevisionWebSocket};
|
use flowy_sync::{RevisionManager, RevisionPersistence, RevisionWebSocket};
|
||||||
use lib_sqlite::ConnectionPool;
|
|
||||||
use parking_lot::RwLock;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use tokio::sync::RwLock;
|
||||||
|
|
||||||
pub trait GridUser: Send + Sync {
|
pub trait GridUser: Send + Sync {
|
||||||
fn user_id(&self) -> Result<String, FlowyError>;
|
fn user_id(&self) -> Result<String, FlowyError>;
|
||||||
|
@ -137,8 +137,8 @@ impl GridManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn get_kv_persistence(&self) -> FlowyResult<Arc<GridKVPersistence>> {
|
async fn get_kv_persistence(&self) -> FlowyResult<Arc<GridKVPersistence>> {
|
||||||
let read_guard = self.kv_persistence.read();
|
let read_guard = self.kv_persistence.read().await;
|
||||||
if read_guard.is_some() {
|
if read_guard.is_some() {
|
||||||
return Ok(read_guard.clone().unwrap());
|
return Ok(read_guard.clone().unwrap());
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ impl GridManager {
|
||||||
|
|
||||||
let pool = self.grid_user.db_pool()?;
|
let pool = self.grid_user.db_pool()?;
|
||||||
let kv_persistence = Arc::new(GridKVPersistence::new(pool));
|
let kv_persistence = Arc::new(GridKVPersistence::new(pool));
|
||||||
*self.kv_persistence.write() = Some(kv_persistence.clone());
|
*self.kv_persistence.write().await = Some(kv_persistence.clone());
|
||||||
Ok(kv_persistence)
|
Ok(kv_persistence)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ use diesel::SqliteConnection;
|
||||||
use flowy_database::{
|
use flowy_database::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
schema::{kv_table, kv_table::dsl},
|
schema::{kv_table, kv_table::dsl},
|
||||||
|
ConnectionPool,
|
||||||
};
|
};
|
||||||
use flowy_error::{FlowyError, FlowyResult};
|
use flowy_error::{FlowyError, FlowyResult};
|
||||||
use lib_sqlite::ConnectionPool;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
#[derive(PartialEq, Clone, Debug, Queryable, Identifiable, Insertable, Associations)]
|
#[derive(PartialEq, Clone, Debug, Queryable, Identifiable, Insertable, Associations)]
|
||||||
|
|
|
@ -14,19 +14,15 @@ flowy-database = { path = "../flowy-database" }
|
||||||
flowy-error = { path = "../flowy-error", features = ["collaboration", "ot", "http_server", "serde", "db"] }
|
flowy-error = { path = "../flowy-error", features = ["collaboration", "ot", "http_server", "serde", "db"] }
|
||||||
diesel = {version = "1.4.8", features = ["sqlite"]}
|
diesel = {version = "1.4.8", features = ["sqlite"]}
|
||||||
diesel_derives = {version = "1.4.1", features = ["sqlite"]}
|
diesel_derives = {version = "1.4.1", features = ["sqlite"]}
|
||||||
protobuf = {version = "2.18.0"}
|
|
||||||
tracing = { version = "0.1", features = ["log"] }
|
tracing = { version = "0.1", features = ["log"] }
|
||||||
tokio = {version = "1", features = ["sync"]}
|
tokio = {version = "1", features = ["sync"]}
|
||||||
bytes = { version = "1.1" }
|
bytes = { version = "1.1" }
|
||||||
strum = "0.21"
|
strum = "0.21"
|
||||||
strum_macros = "0.21"
|
strum_macros = "0.21"
|
||||||
dashmap = "4.0"
|
dashmap = "4.0"
|
||||||
parking_lot = "0.11"
|
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = {version = "1.0"}
|
|
||||||
futures-util = "0.3.15"
|
futures-util = "0.3.15"
|
||||||
async-stream = "0.3.2"
|
async-stream = "0.3.2"
|
||||||
async-trait = "0.1.52"
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
flowy_unit_test = ["lib-ot/flowy_unit_test"]
|
flowy_unit_test = ["lib-ot/flowy_unit_test"]
|
|
@ -8,14 +8,12 @@ edition = "2018"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
flowy-user-data-model = { path = "../../../shared-lib/flowy-user-data-model" }
|
flowy-user-data-model = { path = "../../../shared-lib/flowy-user-data-model" }
|
||||||
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
|
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
|
||||||
lib-infra = { path = "../../../shared-lib/lib-infra" }
|
|
||||||
|
|
||||||
derive_more = {version = "0.99", features = ["display"]}
|
|
||||||
flowy-database = { path = "../flowy-database" }
|
flowy-database = { path = "../flowy-database" }
|
||||||
|
flowy-error = { path = "../flowy-error", features = ["db", "http_server"] }
|
||||||
|
|
||||||
|
lib-infra = { path = "../../../shared-lib/lib-infra" }
|
||||||
dart-notify = { path = "../dart-notify" }
|
dart-notify = { path = "../dart-notify" }
|
||||||
lib-dispatch = { path = "../lib-dispatch" }
|
lib-dispatch = { path = "../lib-dispatch" }
|
||||||
flowy-error = { path = "../flowy-error", features = ["db", "http_server"] }
|
|
||||||
lib-sqlite = { path = "../lib-sqlite" }
|
|
||||||
|
|
||||||
tracing = { version = "0.1", features = ["log"] }
|
tracing = { version = "0.1", features = ["log"] }
|
||||||
bytes = "1.0"
|
bytes = "1.0"
|
||||||
|
@ -26,22 +24,16 @@ protobuf = {version = "2.18.0"}
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
diesel = {version = "1.4.8", features = ["sqlite"]}
|
diesel = {version = "1.4.8", features = ["sqlite"]}
|
||||||
diesel_derives = {version = "1.4.1", features = ["sqlite"]}
|
diesel_derives = {version = "1.4.1", features = ["sqlite"]}
|
||||||
thread_local = "1.1.3"
|
|
||||||
thread-id = "3.3.0"
|
|
||||||
once_cell = "1.7.2"
|
once_cell = "1.7.2"
|
||||||
parking_lot = "0.11"
|
parking_lot = "0.11"
|
||||||
strum = "0.21"
|
strum = "0.21"
|
||||||
strum_macros = "0.21"
|
strum_macros = "0.21"
|
||||||
tokio = { version = "1", features = ["rt"] }
|
tokio = { version = "1", features = ["rt"] }
|
||||||
pin-project = "1.0.0"
|
|
||||||
futures-core = { version = "0.3", default-features = false }
|
|
||||||
r2d2 = "0.8.9"
|
|
||||||
dashmap = "4.0"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
flowy-test = { path = "../flowy-test" }
|
flowy-test = { path = "../flowy-test" }
|
||||||
futures = "0.3.15"
|
futures = "0.3.15"
|
||||||
serial_test = "0.5.1"
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
http_server = []
|
http_server = []
|
||||||
|
|
|
@ -9,7 +9,7 @@ pub mod services;
|
||||||
extern crate flowy_database;
|
extern crate flowy_database;
|
||||||
|
|
||||||
pub mod errors {
|
pub mod errors {
|
||||||
pub use flowy_error::{internal_error, ErrorCode, FlowyError};
|
pub use flowy_error::*;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod entities {
|
pub mod entities {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
use flowy_database::ConnectionPool;
|
||||||
use flowy_database::{schema::user_table, DBConnection, Database};
|
use flowy_database::{schema::user_table, DBConnection, Database};
|
||||||
use flowy_error::FlowyError;
|
use flowy_error::{ErrorCode, FlowyError};
|
||||||
use flowy_user_data_model::entities::{SignInResponse, SignUpResponse, UpdateUserParams, UserProfile};
|
use flowy_user_data_model::entities::{SignInResponse, SignUpResponse, UpdateUserParams, UserProfile};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use lib_sqlite::ConnectionPool;
|
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use parking_lot::{Mutex, RwLock};
|
use parking_lot::{Mutex, RwLock};
|
||||||
use std::{collections::HashMap, sync::Arc, time::Duration};
|
use std::{collections::HashMap, sync::Arc, time::Duration};
|
||||||
|
@ -24,7 +24,7 @@ impl UserDB {
|
||||||
|
|
||||||
fn open_user_db(&self, user_id: &str) -> Result<(), FlowyError> {
|
fn open_user_db(&self, user_id: &str) -> Result<(), FlowyError> {
|
||||||
if user_id.is_empty() {
|
if user_id.is_empty() {
|
||||||
return Err(FlowyError::internal().context("user id is empty"));
|
return Err(ErrorCode::UserIdIsEmpty.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
tracing::info!("open user db {}", user_id);
|
tracing::info!("open user db {}", user_id);
|
||||||
|
|
|
@ -7,6 +7,7 @@ use crate::{
|
||||||
notifier::UserNotifier,
|
notifier::UserNotifier,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use flowy_database::ConnectionPool;
|
||||||
use flowy_database::{
|
use flowy_database::{
|
||||||
kv::KV,
|
kv::KV,
|
||||||
query_dsl::*,
|
query_dsl::*,
|
||||||
|
@ -16,7 +17,6 @@ use flowy_database::{
|
||||||
use flowy_user_data_model::entities::{
|
use flowy_user_data_model::entities::{
|
||||||
SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserParams, UserProfile,
|
SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserParams, UserProfile,
|
||||||
};
|
};
|
||||||
use lib_sqlite::ConnectionPool;
|
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
|
@ -3,7 +3,7 @@ use flowy_test::{event_builder::UserModuleEventBuilder, FlowySDKTest};
|
||||||
use flowy_user::{errors::ErrorCode, event_map::UserEvent::*};
|
use flowy_user::{errors::ErrorCode, event_map::UserEvent::*};
|
||||||
use flowy_user_data_model::entities::{UpdateUserPayload, UserProfile};
|
use flowy_user_data_model::entities::{UpdateUserPayload, UserProfile};
|
||||||
use lib_infra::uuid;
|
use lib_infra::uuid;
|
||||||
use serial_test::*;
|
// use serial_test::*;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn user_profile_get_failed() {
|
async fn user_profile_get_failed() {
|
||||||
|
@ -17,7 +17,6 @@ async fn user_profile_get_failed() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn user_profile_get() {
|
async fn user_profile_get() {
|
||||||
let test = FlowySDKTest::default();
|
let test = FlowySDKTest::default();
|
||||||
let user_profile = test.init_user().await;
|
let user_profile = test.init_user().await;
|
||||||
|
@ -29,7 +28,6 @@ async fn user_profile_get() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn user_update_with_name() {
|
async fn user_update_with_name() {
|
||||||
let sdk = FlowySDKTest::default();
|
let sdk = FlowySDKTest::default();
|
||||||
let user = sdk.init_user().await;
|
let user = sdk.init_user().await;
|
||||||
|
@ -50,7 +48,6 @@ async fn user_update_with_name() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn user_update_with_email() {
|
async fn user_update_with_email() {
|
||||||
let sdk = FlowySDKTest::default();
|
let sdk = FlowySDKTest::default();
|
||||||
let user = sdk.init_user().await;
|
let user = sdk.init_user().await;
|
||||||
|
@ -70,7 +67,6 @@ async fn user_update_with_email() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn user_update_with_password() {
|
async fn user_update_with_password() {
|
||||||
let sdk = FlowySDKTest::default();
|
let sdk = FlowySDKTest::default();
|
||||||
let user = sdk.init_user().await;
|
let user = sdk.init_user().await;
|
||||||
|
@ -85,7 +81,6 @@ async fn user_update_with_password() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn user_update_with_invalid_email() {
|
async fn user_update_with_invalid_email() {
|
||||||
let test = FlowySDKTest::default();
|
let test = FlowySDKTest::default();
|
||||||
let user = test.init_user().await;
|
let user = test.init_user().await;
|
||||||
|
@ -104,7 +99,6 @@ async fn user_update_with_invalid_email() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn user_update_with_invalid_password() {
|
async fn user_update_with_invalid_password() {
|
||||||
let test = FlowySDKTest::default();
|
let test = FlowySDKTest::default();
|
||||||
let user = test.init_user().await;
|
let user = test.init_user().await;
|
||||||
|
@ -120,7 +114,6 @@ async fn user_update_with_invalid_password() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn user_update_with_invalid_name() {
|
async fn user_update_with_invalid_name() {
|
||||||
let test = FlowySDKTest::default();
|
let test = FlowySDKTest::default();
|
||||||
let user = test.init_user().await;
|
let user = test.init_user().await;
|
||||||
|
|
|
@ -15,6 +15,9 @@ pub enum ErrorCode {
|
||||||
#[display(fmt = "RecordNotFound")]
|
#[display(fmt = "RecordNotFound")]
|
||||||
RecordNotFound = 3,
|
RecordNotFound = 3,
|
||||||
|
|
||||||
|
#[display(fmt = "User id is empty")]
|
||||||
|
UserIdIsEmpty = 4,
|
||||||
|
|
||||||
#[display(fmt = "Workspace name can not be empty or whitespace")]
|
#[display(fmt = "Workspace name can not be empty or whitespace")]
|
||||||
WorkspaceNameInvalid = 100,
|
WorkspaceNameInvalid = 100,
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ pub enum ErrorCode {
|
||||||
Internal = 0,
|
Internal = 0,
|
||||||
UserUnauthorized = 2,
|
UserUnauthorized = 2,
|
||||||
RecordNotFound = 3,
|
RecordNotFound = 3,
|
||||||
|
UserIdIsEmpty = 4,
|
||||||
WorkspaceNameInvalid = 100,
|
WorkspaceNameInvalid = 100,
|
||||||
WorkspaceIdInvalid = 101,
|
WorkspaceIdInvalid = 101,
|
||||||
AppColorStyleInvalid = 102,
|
AppColorStyleInvalid = 102,
|
||||||
|
@ -72,6 +73,7 @@ impl ::protobuf::ProtobufEnum for ErrorCode {
|
||||||
0 => ::std::option::Option::Some(ErrorCode::Internal),
|
0 => ::std::option::Option::Some(ErrorCode::Internal),
|
||||||
2 => ::std::option::Option::Some(ErrorCode::UserUnauthorized),
|
2 => ::std::option::Option::Some(ErrorCode::UserUnauthorized),
|
||||||
3 => ::std::option::Option::Some(ErrorCode::RecordNotFound),
|
3 => ::std::option::Option::Some(ErrorCode::RecordNotFound),
|
||||||
|
4 => ::std::option::Option::Some(ErrorCode::UserIdIsEmpty),
|
||||||
100 => ::std::option::Option::Some(ErrorCode::WorkspaceNameInvalid),
|
100 => ::std::option::Option::Some(ErrorCode::WorkspaceNameInvalid),
|
||||||
101 => ::std::option::Option::Some(ErrorCode::WorkspaceIdInvalid),
|
101 => ::std::option::Option::Some(ErrorCode::WorkspaceIdInvalid),
|
||||||
102 => ::std::option::Option::Some(ErrorCode::AppColorStyleInvalid),
|
102 => ::std::option::Option::Some(ErrorCode::AppColorStyleInvalid),
|
||||||
|
@ -113,6 +115,7 @@ impl ::protobuf::ProtobufEnum for ErrorCode {
|
||||||
ErrorCode::Internal,
|
ErrorCode::Internal,
|
||||||
ErrorCode::UserUnauthorized,
|
ErrorCode::UserUnauthorized,
|
||||||
ErrorCode::RecordNotFound,
|
ErrorCode::RecordNotFound,
|
||||||
|
ErrorCode::UserIdIsEmpty,
|
||||||
ErrorCode::WorkspaceNameInvalid,
|
ErrorCode::WorkspaceNameInvalid,
|
||||||
ErrorCode::WorkspaceIdInvalid,
|
ErrorCode::WorkspaceIdInvalid,
|
||||||
ErrorCode::AppColorStyleInvalid,
|
ErrorCode::AppColorStyleInvalid,
|
||||||
|
@ -173,26 +176,27 @@ impl ::protobuf::reflect::ProtobufValue for ErrorCode {
|
||||||
}
|
}
|
||||||
|
|
||||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||||
\n\ncode.proto*\xa4\x06\n\tErrorCode\x12\x0c\n\x08Internal\x10\0\x12\x14\
|
\n\ncode.proto*\xb7\x06\n\tErrorCode\x12\x0c\n\x08Internal\x10\0\x12\x14\
|
||||||
\n\x10UserUnauthorized\x10\x02\x12\x12\n\x0eRecordNotFound\x10\x03\x12\
|
\n\x10UserUnauthorized\x10\x02\x12\x12\n\x0eRecordNotFound\x10\x03\x12\
|
||||||
\x18\n\x14WorkspaceNameInvalid\x10d\x12\x16\n\x12WorkspaceIdInvalid\x10e\
|
\x11\n\rUserIdIsEmpty\x10\x04\x12\x18\n\x14WorkspaceNameInvalid\x10d\x12\
|
||||||
\x12\x18\n\x14AppColorStyleInvalid\x10f\x12\x18\n\x14WorkspaceDescTooLon\
|
\x16\n\x12WorkspaceIdInvalid\x10e\x12\x18\n\x14AppColorStyleInvalid\x10f\
|
||||||
g\x10g\x12\x18\n\x14WorkspaceNameTooLong\x10h\x12\x10\n\x0cAppIdInvalid\
|
\x12\x18\n\x14WorkspaceDescTooLong\x10g\x12\x18\n\x14WorkspaceNameTooLon\
|
||||||
\x10n\x12\x12\n\x0eAppNameInvalid\x10o\x12\x13\n\x0fViewNameInvalid\x10x\
|
g\x10h\x12\x10\n\x0cAppIdInvalid\x10n\x12\x12\n\x0eAppNameInvalid\x10o\
|
||||||
\x12\x18\n\x14ViewThumbnailInvalid\x10y\x12\x11\n\rViewIdInvalid\x10z\
|
\x12\x13\n\x0fViewNameInvalid\x10x\x12\x18\n\x14ViewThumbnailInvalid\x10\
|
||||||
\x12\x13\n\x0fViewDescTooLong\x10{\x12\x13\n\x0fViewDataInvalid\x10|\x12\
|
y\x12\x11\n\rViewIdInvalid\x10z\x12\x13\n\x0fViewDescTooLong\x10{\x12\
|
||||||
\x13\n\x0fViewNameTooLong\x10}\x12\x11\n\x0cConnectError\x10\xc8\x01\x12\
|
\x13\n\x0fViewDataInvalid\x10|\x12\x13\n\x0fViewNameTooLong\x10}\x12\x11\
|
||||||
\x11\n\x0cEmailIsEmpty\x10\xac\x02\x12\x17\n\x12EmailFormatInvalid\x10\
|
\n\x0cConnectError\x10\xc8\x01\x12\x11\n\x0cEmailIsEmpty\x10\xac\x02\x12\
|
||||||
\xad\x02\x12\x17\n\x12EmailAlreadyExists\x10\xae\x02\x12\x14\n\x0fPasswo\
|
\x17\n\x12EmailFormatInvalid\x10\xad\x02\x12\x17\n\x12EmailAlreadyExists\
|
||||||
rdIsEmpty\x10\xaf\x02\x12\x14\n\x0fPasswordTooLong\x10\xb0\x02\x12%\n\
|
\x10\xae\x02\x12\x14\n\x0fPasswordIsEmpty\x10\xaf\x02\x12\x14\n\x0fPassw\
|
||||||
\x20PasswordContainsForbidCharacters\x10\xb1\x02\x12\x1a\n\x15PasswordFo\
|
ordTooLong\x10\xb0\x02\x12%\n\x20PasswordContainsForbidCharacters\x10\
|
||||||
rmatInvalid\x10\xb2\x02\x12\x15\n\x10PasswordNotMatch\x10\xb3\x02\x12\
|
\xb1\x02\x12\x1a\n\x15PasswordFormatInvalid\x10\xb2\x02\x12\x15\n\x10Pas\
|
||||||
\x14\n\x0fUserNameTooLong\x10\xb4\x02\x12'\n\"UserNameContainForbiddenCh\
|
swordNotMatch\x10\xb3\x02\x12\x14\n\x0fUserNameTooLong\x10\xb4\x02\x12'\
|
||||||
aracters\x10\xb5\x02\x12\x14\n\x0fUserNameIsEmpty\x10\xb6\x02\x12\x12\n\
|
\n\"UserNameContainForbiddenCharacters\x10\xb5\x02\x12\x14\n\x0fUserName\
|
||||||
\rUserIdInvalid\x10\xb7\x02\x12\x11\n\x0cUserNotExist\x10\xb8\x02\x12\
|
IsEmpty\x10\xb6\x02\x12\x12\n\rUserIdInvalid\x10\xb7\x02\x12\x11\n\x0cUs\
|
||||||
\x10\n\x0bTextTooLong\x10\x90\x03\x12\x13\n\x0eBlockIdIsEmpty\x10\x91\
|
erNotExist\x10\xb8\x02\x12\x10\n\x0bTextTooLong\x10\x90\x03\x12\x13\n\
|
||||||
\x03\x12\x11\n\x0cRowIdIsEmpty\x10\x92\x03\x12\x12\n\rGridIdIsEmpty\x10\
|
\x0eBlockIdIsEmpty\x10\x91\x03\x12\x11\n\x0cRowIdIsEmpty\x10\x92\x03\x12\
|
||||||
\x93\x03\x12\x10\n\x0bInvalidData\x10\x94\x03b\x06proto3\
|
\x12\n\rGridIdIsEmpty\x10\x93\x03\x12\x10\n\x0bInvalidData\x10\x94\x03b\
|
||||||
|
\x06proto3\
|
||||||
";
|
";
|
||||||
|
|
||||||
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
|
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
|
||||||
|
|
|
@ -4,6 +4,7 @@ enum ErrorCode {
|
||||||
Internal = 0;
|
Internal = 0;
|
||||||
UserUnauthorized = 2;
|
UserUnauthorized = 2;
|
||||||
RecordNotFound = 3;
|
RecordNotFound = 3;
|
||||||
|
UserIdIsEmpty = 4;
|
||||||
WorkspaceNameInvalid = 100;
|
WorkspaceNameInvalid = 100;
|
||||||
WorkspaceIdInvalid = 101;
|
WorkspaceIdInvalid = 101;
|
||||||
AppColorStyleInvalid = 102;
|
AppColorStyleInvalid = 102;
|
||||||
|
|
|
@ -5,7 +5,8 @@ use crate::entities::{
|
||||||
};
|
};
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
|
|
||||||
pub fn create_default_workspace(time: chrono::DateTime<Utc>) -> Workspace {
|
pub fn create_default_workspace() -> Workspace {
|
||||||
|
let time = Utc::now();
|
||||||
let workspace_id = uuid::Uuid::new_v4();
|
let workspace_id = uuid::Uuid::new_v4();
|
||||||
let name = "Workspace".to_string();
|
let name = "Workspace".to_string();
|
||||||
let desc = "".to_string();
|
let desc = "".to_string();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue