From 23968d89fc673791ba55da190e9ec53690695647 Mon Sep 17 00:00:00 2001 From: "Nathan.fooo" <86001920+appflowy@users.noreply.github.com> Date: Thu, 22 Aug 2024 07:45:51 +0800 Subject: [PATCH] chore: Upgrade collab version (#6028) * chore: write collab to disk if it's not exist * chore: write collab if it's not exit * chore: fix test * chore: upgrade appflowy collab * chore: upgrade appflowy collab * chore: update collab version * chore: fix test --- frontend/appflowy_tauri/src-tauri/Cargo.lock | 14 +++++++------- frontend/appflowy_tauri/src-tauri/Cargo.toml | 14 +++++++------- frontend/appflowy_web_app/src-tauri/Cargo.lock | 14 +++++++------- frontend/appflowy_web_app/src-tauri/Cargo.toml | 14 +++++++------- frontend/rust-lib/Cargo.lock | 14 +++++++------- frontend/rust-lib/Cargo.toml | 14 +++++++------- .../tests/database/af_cloud/util.rs | 3 ++- frontend/rust-lib/flowy-database2/src/manager.rs | 3 ++- .../src/services/database/database_editor.rs | 11 +++++------ .../flowy-database2/src/services/database/util.rs | 3 ++- .../src/services/database_view/view_editor.rs | 3 ++- .../src/services/database_view/view_operation.rs | 8 ++++---- .../src/services/share/csv/import.rs | 3 ++- frontend/rust-lib/flowy-database2/src/template.rs | 5 ++--- .../tests/database/mock_data/board_mock_data.rs | 3 ++- .../tests/database/mock_data/calendar_mock_data.rs | 3 ++- .../tests/database/mock_data/grid_mock_data.rs | 3 ++- 17 files changed, 69 insertions(+), 63 deletions(-) diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.lock b/frontend/appflowy_tauri/src-tauri/Cargo.lock index 99f7541e17..c8d23c0f3e 100644 --- a/frontend/appflowy_tauri/src-tauri/Cargo.lock +++ b/frontend/appflowy_tauri/src-tauri/Cargo.lock @@ -963,7 +963,7 @@ dependencies = [ [[package]] name = "collab" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "arc-swap", @@ -988,7 +988,7 @@ dependencies = [ [[package]] name = "collab-database" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "async-trait", @@ -1018,7 +1018,7 @@ dependencies = [ [[package]] name = "collab-document" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "arc-swap", @@ -1038,7 +1038,7 @@ dependencies = [ [[package]] name = "collab-entity" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "bytes", @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "collab-folder" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "arc-swap", @@ -1100,7 +1100,7 @@ dependencies = [ [[package]] name = "collab-plugins" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "async-stream", @@ -1180,7 +1180,7 @@ dependencies = [ [[package]] name = "collab-user" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "collab", diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.toml b/frontend/appflowy_tauri/src-tauri/Cargo.toml index 23e30f4bfd..c52affb190 100644 --- a/frontend/appflowy_tauri/src-tauri/Cargo.toml +++ b/frontend/appflowy_tauri/src-tauri/Cargo.toml @@ -116,13 +116,13 @@ custom-protocol = ["tauri/custom-protocol"] # To switch to the local path, run: # scripts/tool/update_collab_source.sh # ⚠️⚠️⚠️️ -collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } +collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } # Working directory: frontend # To update the commit ID, run: diff --git a/frontend/appflowy_web_app/src-tauri/Cargo.lock b/frontend/appflowy_web_app/src-tauri/Cargo.lock index 56ffd76575..23520cb464 100644 --- a/frontend/appflowy_web_app/src-tauri/Cargo.lock +++ b/frontend/appflowy_web_app/src-tauri/Cargo.lock @@ -946,7 +946,7 @@ dependencies = [ [[package]] name = "collab" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "arc-swap", @@ -971,7 +971,7 @@ dependencies = [ [[package]] name = "collab-database" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "async-trait", @@ -1001,7 +1001,7 @@ dependencies = [ [[package]] name = "collab-document" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "arc-swap", @@ -1021,7 +1021,7 @@ dependencies = [ [[package]] name = "collab-entity" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "bytes", @@ -1040,7 +1040,7 @@ dependencies = [ [[package]] name = "collab-folder" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "arc-swap", @@ -1083,7 +1083,7 @@ dependencies = [ [[package]] name = "collab-plugins" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "async-stream", @@ -1163,7 +1163,7 @@ dependencies = [ [[package]] name = "collab-user" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "collab", diff --git a/frontend/appflowy_web_app/src-tauri/Cargo.toml b/frontend/appflowy_web_app/src-tauri/Cargo.toml index 10142f4acc..1fd172a734 100644 --- a/frontend/appflowy_web_app/src-tauri/Cargo.toml +++ b/frontend/appflowy_web_app/src-tauri/Cargo.toml @@ -116,13 +116,13 @@ custom-protocol = ["tauri/custom-protocol"] # To switch to the local path, run: # scripts/tool/update_collab_source.sh # ⚠️⚠️⚠️️ -collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } +collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } # Working directory: frontend # To update the commit ID, run: diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock index 01f2ca464a..9f6162a0ba 100644 --- a/frontend/rust-lib/Cargo.lock +++ b/frontend/rust-lib/Cargo.lock @@ -824,7 +824,7 @@ dependencies = [ [[package]] name = "collab" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "arc-swap", @@ -849,7 +849,7 @@ dependencies = [ [[package]] name = "collab-database" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "async-trait", @@ -879,7 +879,7 @@ dependencies = [ [[package]] name = "collab-document" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "arc-swap", @@ -899,7 +899,7 @@ dependencies = [ [[package]] name = "collab-entity" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "bytes", @@ -918,7 +918,7 @@ dependencies = [ [[package]] name = "collab-folder" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "arc-swap", @@ -961,7 +961,7 @@ dependencies = [ [[package]] name = "collab-plugins" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "async-stream", @@ -1041,7 +1041,7 @@ dependencies = [ [[package]] name = "collab-user" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6a5e7e49c159fcf782df84208cdb26c212c28ede#6a5e7e49c159fcf782df84208cdb26c212c28ede" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4c0d2cd#4c0d2cdeefbde35b22d0716303339030b66af6a5" dependencies = [ "anyhow", "collab", diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml index cb09e65d6b..4f21b5f610 100644 --- a/frontend/rust-lib/Cargo.toml +++ b/frontend/rust-lib/Cargo.toml @@ -136,13 +136,13 @@ rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb", rev = "1710120 # To switch to the local path, run: # scripts/tool/update_collab_source.sh # ⚠️⚠️⚠️️ -collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } -collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6a5e7e49c159fcf782df84208cdb26c212c28ede" } +collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } +collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4c0d2cd" } # Working directory: frontend # To update the commit ID, run: diff --git a/frontend/rust-lib/event-integration-test/tests/database/af_cloud/util.rs b/frontend/rust-lib/event-integration-test/tests/database/af_cloud/util.rs index 25ef9920c8..0c155c634e 100644 --- a/frontend/rust-lib/event-integration-test/tests/database/af_cloud/util.rs +++ b/frontend/rust-lib/event-integration-test/tests/database/af_cloud/util.rs @@ -1,5 +1,6 @@ use collab_database::database::{gen_database_id, gen_database_view_id, gen_row_id, DatabaseData}; -use collab_database::views::{DatabaseLayout, DatabaseView}; +use collab_database::entity::DatabaseView; +use collab_database::views::DatabaseLayout; use event_integration_test::database_event::TestRowBuilder; use collab_database::fields::Field; diff --git a/frontend/rust-lib/flowy-database2/src/manager.rs b/frontend/rust-lib/flowy-database2/src/manager.rs index f4f95b8d39..6c204ce627 100644 --- a/frontend/rust-lib/flowy-database2/src/manager.rs +++ b/frontend/rust-lib/flowy-database2/src/manager.rs @@ -8,9 +8,10 @@ use std::sync::{Arc, Weak}; use collab::core::collab::DataSource; use collab::preclude::Collab; use collab_database::database::{Database, DatabaseData}; +use collab_database::entity::{CreateDatabaseParams, CreateViewParams}; use collab_database::error::DatabaseError; use collab_database::rows::RowId; -use collab_database::views::{CreateDatabaseParams, CreateViewParams, DatabaseLayout}; +use collab_database::views::DatabaseLayout; use collab_database::workspace_database::{ DatabaseCollabService, DatabaseMeta, EncodeCollabByOid, WorkspaceDatabase, }; diff --git a/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs index fcd6c253a1..8d226c6d17 100644 --- a/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs +++ b/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs @@ -22,11 +22,10 @@ use crate::utils::cache::AnyTypeCache; use crate::DatabaseUser; use async_trait::async_trait; use collab_database::database::Database; +use collab_database::entity::DatabaseView; use collab_database::fields::{Field, TypeOptionData}; use collab_database::rows::{Cell, Cells, Row, RowCell, RowDetail, RowId}; -use collab_database::views::{ - DatabaseLayout, DatabaseView, FilterMap, LayoutSetting, OrderObjectPosition, -}; +use collab_database::views::{DatabaseLayout, FilterMap, LayoutSetting, OrderObjectPosition}; use collab_entity::CollabType; use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabBuilderConfig}; use flowy_error::{internal_error, ErrorCode, FlowyError, FlowyResult}; @@ -508,7 +507,7 @@ impl DatabaseEditor { .await .ok_or_else(|| FlowyError::internal().with_context("error while copying row"))?; - let (index, row_order) = database.create_row_in_view(view_id, params); + let (index, row_order) = database.create_row_in_view(view_id, params)?; trace!( "duplicate row: {:?} at index:{}, new row:{:?}", row_id, @@ -578,9 +577,9 @@ impl DatabaseEditor { } = view_editor.v_will_create_row(params).await?; let mut database = self.database.write().await; - let (index, order_id) = database.create_row_in_view(&view_editor.view_id, collab_params); + let (index, order_id) = database.create_row_in_view(&view_editor.view_id, collab_params)?; let row_detail = database.get_row_detail(&order_id.id).await; - drop(database); // Explicitly release the lock here + drop(database); if let Some(row_detail) = row_detail { trace!("created row: {:?} at {}", row_detail, index); diff --git a/frontend/rust-lib/flowy-database2/src/services/database/util.rs b/frontend/rust-lib/flowy-database2/src/services/database/util.rs index 4a3810b198..76e34e22ab 100644 --- a/frontend/rust-lib/flowy-database2/src/services/database/util.rs +++ b/frontend/rust-lib/flowy-database2/src/services/database/util.rs @@ -1,4 +1,5 @@ -use collab_database::views::{DatabaseLayout, DatabaseView}; +use collab_database::entity::DatabaseView; +use collab_database::views::DatabaseLayout; use crate::entities::{ DatabaseLayoutPB, DatabaseLayoutSettingPB, DatabaseViewSettingPB, FieldSettingsPB, FilterPB, diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs index 47dc49c516..12a2385ace 100644 --- a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs +++ b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs @@ -3,9 +3,10 @@ use std::collections::HashMap; use std::sync::Arc; use collab_database::database::{gen_database_calculation_id, gen_database_sort_id, gen_row_id}; +use collab_database::entity::DatabaseView; use collab_database::fields::Field; use collab_database::rows::{Cells, Row, RowDetail, RowId}; -use collab_database::views::{DatabaseLayout, DatabaseView}; +use collab_database::views::DatabaseLayout; use lib_infra::util::timestamp; use tokio::sync::{broadcast, RwLock}; use tracing::instrument; diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/view_operation.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/view_operation.rs index 95c092702e..534fec85b8 100644 --- a/frontend/rust-lib/flowy-database2/src/services/database_view/view_operation.rs +++ b/frontend/rust-lib/flowy-database2/src/services/database_view/view_operation.rs @@ -1,11 +1,11 @@ use async_trait::async_trait; use collab_database::database::Database; -use std::collections::HashMap; -use std::sync::Arc; - +use collab_database::entity::DatabaseView; use collab_database::fields::{Field, TypeOptionData}; use collab_database::rows::{Row, RowCell, RowDetail, RowId}; -use collab_database::views::{DatabaseLayout, DatabaseView, LayoutSetting}; +use collab_database::views::{DatabaseLayout, LayoutSetting}; +use std::collections::HashMap; +use std::sync::Arc; use tokio::sync::RwLock; use flowy_error::FlowyError; diff --git a/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rs b/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rs index 8cf6aa4e23..dab2b981c9 100644 --- a/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rs +++ b/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rs @@ -1,9 +1,10 @@ use std::{fs::File, io::prelude::*}; use collab_database::database::{gen_database_id, gen_field_id, gen_row_id, timestamp}; +use collab_database::entity::{CreateDatabaseParams, CreateViewParams}; use collab_database::fields::Field; use collab_database::rows::{new_cell_builder, Cell, CreateRowParams}; -use collab_database::views::{CreateDatabaseParams, CreateViewParams, DatabaseLayout}; +use collab_database::views::DatabaseLayout; use collab_entity::EncodedCollab; use flowy_error::{FlowyError, FlowyResult}; diff --git a/frontend/rust-lib/flowy-database2/src/template.rs b/frontend/rust-lib/flowy-database2/src/template.rs index c0347be580..0afa6fdd76 100644 --- a/frontend/rust-lib/flowy-database2/src/template.rs +++ b/frontend/rust-lib/flowy-database2/src/template.rs @@ -1,8 +1,7 @@ use collab_database::database::{gen_database_id, gen_row_id, timestamp}; +use collab_database::entity::{CreateDatabaseParams, CreateViewParams}; use collab_database::rows::CreateRowParams; -use collab_database::views::{ - CreateDatabaseParams, CreateViewParams, DatabaseLayout, LayoutSettings, -}; +use collab_database::views::{DatabaseLayout, LayoutSettings}; use crate::entities::FieldType; use crate::services::cell::{insert_select_option_cell, insert_text_cell}; diff --git a/frontend/rust-lib/flowy-database2/tests/database/mock_data/board_mock_data.rs b/frontend/rust-lib/flowy-database2/tests/database/mock_data/board_mock_data.rs index d722a352f3..4bcb6d02d5 100644 --- a/frontend/rust-lib/flowy-database2/tests/database/mock_data/board_mock_data.rs +++ b/frontend/rust-lib/flowy-database2/tests/database/mock_data/board_mock_data.rs @@ -1,5 +1,6 @@ use collab_database::database::{gen_database_id, gen_database_view_id, gen_row_id, DatabaseData}; -use collab_database::views::{DatabaseLayout, DatabaseView, LayoutSetting, LayoutSettings}; +use collab_database::entity::DatabaseView; +use collab_database::views::{DatabaseLayout, LayoutSetting, LayoutSettings}; use strum::IntoEnumIterator; use crate::database::mock_data::{COMPLETED, FACEBOOK, GOOGLE, PAUSED, PLANNED, TWITTER}; diff --git a/frontend/rust-lib/flowy-database2/tests/database/mock_data/calendar_mock_data.rs b/frontend/rust-lib/flowy-database2/tests/database/mock_data/calendar_mock_data.rs index 4c7553f754..476d8b7faf 100644 --- a/frontend/rust-lib/flowy-database2/tests/database/mock_data/calendar_mock_data.rs +++ b/frontend/rust-lib/flowy-database2/tests/database/mock_data/calendar_mock_data.rs @@ -1,5 +1,6 @@ use collab_database::database::{gen_database_id, gen_database_view_id, gen_row_id, DatabaseData}; -use collab_database::views::{DatabaseLayout, DatabaseView, LayoutSetting, LayoutSettings}; +use collab_database::entity::DatabaseView; +use collab_database::views::{DatabaseLayout, LayoutSetting, LayoutSettings}; use flowy_database2::services::field_settings::default_field_settings_for_fields; use strum::IntoEnumIterator; diff --git a/frontend/rust-lib/flowy-database2/tests/database/mock_data/grid_mock_data.rs b/frontend/rust-lib/flowy-database2/tests/database/mock_data/grid_mock_data.rs index 6896e47ccb..fbc62606a7 100644 --- a/frontend/rust-lib/flowy-database2/tests/database/mock_data/grid_mock_data.rs +++ b/frontend/rust-lib/flowy-database2/tests/database/mock_data/grid_mock_data.rs @@ -1,5 +1,6 @@ use collab_database::database::{gen_database_id, gen_database_view_id, gen_row_id, DatabaseData}; -use collab_database::views::{DatabaseLayout, DatabaseView}; +use collab_database::entity::DatabaseView; +use collab_database::views::DatabaseLayout; use strum::IntoEnumIterator; use crate::database::mock_data::{COMPLETED, FACEBOOK, GOOGLE, PAUSED, PLANNED, TWITTER};