Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
[rust]: read workspace,app,view in create_time asc order
appflowy019f7cc45db4
diff --git a/Makefile.toml b/Makefile.tomlindex e30a3a9526..f27307faa6 100644--- a/Makefile.toml+++ b/Makefile.toml@@ -25,7 +25,6 @@ CRATE_TYPE = "cdylib"BUILD_FLAG = "debug"FLUTTER_PLATFORM = "macos"FLUTTER_OUTPUT_DIR = "Debug"-FEATURES = "flutter"PRODUCT_EXT = "app"diff --git a/app_flowy/macos/Podfile.lock b/app_flowy/macos/Podfile.lockindex 40d1d38056..ce4f1af669 100644--- a/app_flowy/macos/Podfile.lock+++ b/app_flowy/macos/Podfile.lock@@ -55,4 +55,4 @@ SPEC CHECKSUMS:PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c-COCOAPODS: 1.11.2+COCOAPODS: 1.10.1diff --git a/app_flowy/pubspec.yaml b/app_flowy/pubspec.yamlindex 9186e67ace..ed436c54f3 100644--- a/app_flowy/pubspec.yaml+++ b/app_flowy/pubspec.yaml@@ -40,7 +40,6 @@ dependencies:flowy_log:path: packages/flowy_logflutter_quill:- # path: packages/flutter-quillgit:url: [email protected]:appflowy/flutter-quill.gitref: developdiff --git a/rust-lib/flowy-workspace/src/handlers/workspace_handler.rs b/rust-lib/flowy-workspace/src/handlers/workspace_handler.rsindex b712a2083d..640ec66725 100644--- a/rust-lib/flowy-workspace/src/handlers/workspace_handler.rs+++ b/rust-lib/flowy-workspace/src/handlers/workspace_handler.rs@@ -27,7 +27,7 @@ pub(crate) async fn create_workspace_handler(pub(crate) async fn read_cur_workspace_handler(controller: Unit<Arc<WorkspaceController>>,) -> DataResult<Workspace, WorkspaceError> {- let workspace = controller.read_cur_workspace().await?;+ let workspace = controller.read_current_workspace().await?;data_result(workspace)}@@ -35,7 +35,7 @@ pub(crate) async fn read_cur_workspace_handler(pub(crate) async fn read_workspace_apps_handler(controller: Unit<Arc<WorkspaceController>>,) -> DataResult<RepeatedApp, WorkspaceError> {- let repeated_app = controller.read_workspace_apps().await?;+ let repeated_app = controller.read_current_workspace_apps().await?;data_result(repeated_app)}diff --git a/rust-lib/flowy-workspace/src/services/workspace_controller.rs b/rust-lib/flowy-workspace/src/services/workspace_controller.rsindex 552be0211d..2f43fe6092 100644--- a/rust-lib/flowy-workspace/src/services/workspace_controller.rs+++ b/rust-lib/flowy-workspace/src/services/workspace_controller.rs@@ -141,7 +141,7 @@ impl WorkspaceController {Ok(workspaces)}- pub(crate) async fn read_cur_workspace(&self) -> Result<Workspace, WorkspaceError> {+ pub(crate) async fn read_current_workspace(&self) -> Result<Workspace, WorkspaceError> {let workspace_id = get_current_workspace()?;let user_id = self.user.user_id()?;let params = QueryWorkspaceParams {@@ -153,7 +153,7 @@ impl WorkspaceController {Ok(workspace)}- pub(crate) async fn read_workspace_apps(&self) -> Result<RepeatedApp, WorkspaceError> {+ pub(crate) async fn read_current_workspace_apps(&self) -> Result<RepeatedApp, WorkspaceError> {let workspace_id = get_current_workspace()?;let conn = self.database.db_connection()?;let repeated_app = self.read_local_apps(&workspace_id, &*conn)?;diff --git a/rust-lib/flowy-workspace/src/sql_tables/app/app_sql.rs b/rust-lib/flowy-workspace/src/sql_tables/app/app_sql.rsindex 95ced5c4df..d3d623c598 100644--- a/rust-lib/flowy-workspace/src/sql_tables/app/app_sql.rs+++ b/rust-lib/flowy-workspace/src/sql_tables/app/app_sql.rs@@ -41,6 +41,7 @@ impl AppTableSql {let app_table = dsl::app_table.filter(app_table::workspace_id.eq(workspace_id)).filter(app_table::is_trash.eq(is_trash))+ .order(app_table::create_time.asc()).load::<AppTable>(conn)?;Ok(app_table)diff --git a/rust-lib/flowy-workspace/src/sql_tables/view/view_sql.rs b/rust-lib/flowy-workspace/src/sql_tables/view/view_sql.rsindex 2eeb326321..39784b6a1d 100644--- a/rust-lib/flowy-workspace/src/sql_tables/view/view_sql.rs+++ b/rust-lib/flowy-workspace/src/sql_tables/view/view_sql.rs@@ -41,6 +41,7 @@ impl ViewTableSql {pub(crate) fn read_views(belong_to_id: &str, conn: &SqliteConnection) -> Result<Vec<ViewTable>, WorkspaceError> {let view_tables = dsl::view_table.filter(view_table::belong_to_id.eq(belong_to_id))+ .order(view_table::create_time.asc()).into_boxed().load::<ViewTable>(conn)?;diff --git a/rust-lib/flowy-workspace/src/sql_tables/workspace/workspace_sql.rs b/rust-lib/flowy-workspace/src/sql_tables/workspace/workspace_sql.rsindex af6f179214..811d96c529 100644--- a/rust-lib/flowy-workspace/src/sql_tables/workspace/workspace_sql.rs+++ b/rust-lib/flowy-workspace/src/sql_tables/workspace/workspace_sql.rs@@ -32,16 +32,17 @@ impl WorkspaceTableSql {user_id: &str,conn: &SqliteConnection,) -> Result<Vec<WorkspaceTable>, WorkspaceError> {- let workspaces = match workspace_id {- None => dsl::workspace_table- .filter(workspace_table::user_id.eq(user_id))- .load::<WorkspaceTable>(conn)?,- Some(workspace_id) => dsl::workspace_table- .filter(workspace_table::user_id.eq(user_id))- .filter(workspace_table::id.eq(&workspace_id))- .load::<WorkspaceTable>(conn)?,+ let mut filter = dsl::workspace_table+ .filter(workspace_table::user_id.eq(user_id))+ .order(workspace_table::create_time.asc())+ .into_boxed();++ if let Some(workspace_id) = workspace_id {+ filter = filter.filter(workspace_table::id.eq(workspace_id.to_owned()));};+ let workspaces = filter.load::<WorkspaceTable>(conn)?;+Ok(workspaces)}