mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-24 22:57:12 -04:00
[rust]: read workspace,app,view in create_time asc order
This commit is contained in:
parent
c21709b36f
commit
019f7cc45d
8 changed files with 16 additions and 15 deletions
|
@ -25,7 +25,6 @@ CRATE_TYPE = "cdylib"
|
||||||
BUILD_FLAG = "debug"
|
BUILD_FLAG = "debug"
|
||||||
FLUTTER_PLATFORM = "macos"
|
FLUTTER_PLATFORM = "macos"
|
||||||
FLUTTER_OUTPUT_DIR = "Debug"
|
FLUTTER_OUTPUT_DIR = "Debug"
|
||||||
FEATURES = "flutter"
|
|
||||||
PRODUCT_EXT = "app"
|
PRODUCT_EXT = "app"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,4 +55,4 @@ SPEC CHECKSUMS:
|
||||||
|
|
||||||
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
|
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
|
||||||
|
|
||||||
COCOAPODS: 1.11.2
|
COCOAPODS: 1.10.1
|
||||||
|
|
|
@ -40,7 +40,6 @@ dependencies:
|
||||||
flowy_log:
|
flowy_log:
|
||||||
path: packages/flowy_log
|
path: packages/flowy_log
|
||||||
flutter_quill:
|
flutter_quill:
|
||||||
# path: packages/flutter-quill
|
|
||||||
git:
|
git:
|
||||||
url: git@github.com:appflowy/flutter-quill.git
|
url: git@github.com:appflowy/flutter-quill.git
|
||||||
ref: develop
|
ref: develop
|
||||||
|
|
|
@ -27,7 +27,7 @@ pub(crate) async fn create_workspace_handler(
|
||||||
pub(crate) async fn read_cur_workspace_handler(
|
pub(crate) async fn read_cur_workspace_handler(
|
||||||
controller: Unit<Arc<WorkspaceController>>,
|
controller: Unit<Arc<WorkspaceController>>,
|
||||||
) -> DataResult<Workspace, WorkspaceError> {
|
) -> DataResult<Workspace, WorkspaceError> {
|
||||||
let workspace = controller.read_cur_workspace().await?;
|
let workspace = controller.read_current_workspace().await?;
|
||||||
data_result(workspace)
|
data_result(workspace)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ pub(crate) async fn read_cur_workspace_handler(
|
||||||
pub(crate) async fn read_workspace_apps_handler(
|
pub(crate) async fn read_workspace_apps_handler(
|
||||||
controller: Unit<Arc<WorkspaceController>>,
|
controller: Unit<Arc<WorkspaceController>>,
|
||||||
) -> DataResult<RepeatedApp, WorkspaceError> {
|
) -> DataResult<RepeatedApp, WorkspaceError> {
|
||||||
let repeated_app = controller.read_workspace_apps().await?;
|
let repeated_app = controller.read_current_workspace_apps().await?;
|
||||||
data_result(repeated_app)
|
data_result(repeated_app)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ impl WorkspaceController {
|
||||||
Ok(workspaces)
|
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 workspace_id = get_current_workspace()?;
|
||||||
let user_id = self.user.user_id()?;
|
let user_id = self.user.user_id()?;
|
||||||
let params = QueryWorkspaceParams {
|
let params = QueryWorkspaceParams {
|
||||||
|
@ -153,7 +153,7 @@ impl WorkspaceController {
|
||||||
Ok(workspace)
|
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 workspace_id = get_current_workspace()?;
|
||||||
let conn = self.database.db_connection()?;
|
let conn = self.database.db_connection()?;
|
||||||
let repeated_app = self.read_local_apps(&workspace_id, &*conn)?;
|
let repeated_app = self.read_local_apps(&workspace_id, &*conn)?;
|
||||||
|
|
|
@ -41,6 +41,7 @@ impl AppTableSql {
|
||||||
let app_table = dsl::app_table
|
let app_table = dsl::app_table
|
||||||
.filter(app_table::workspace_id.eq(workspace_id))
|
.filter(app_table::workspace_id.eq(workspace_id))
|
||||||
.filter(app_table::is_trash.eq(is_trash))
|
.filter(app_table::is_trash.eq(is_trash))
|
||||||
|
.order(app_table::create_time.asc())
|
||||||
.load::<AppTable>(conn)?;
|
.load::<AppTable>(conn)?;
|
||||||
|
|
||||||
Ok(app_table)
|
Ok(app_table)
|
||||||
|
|
|
@ -41,6 +41,7 @@ impl ViewTableSql {
|
||||||
pub(crate) fn read_views(belong_to_id: &str, conn: &SqliteConnection) -> Result<Vec<ViewTable>, WorkspaceError> {
|
pub(crate) fn read_views(belong_to_id: &str, conn: &SqliteConnection) -> Result<Vec<ViewTable>, WorkspaceError> {
|
||||||
let view_tables = dsl::view_table
|
let view_tables = dsl::view_table
|
||||||
.filter(view_table::belong_to_id.eq(belong_to_id))
|
.filter(view_table::belong_to_id.eq(belong_to_id))
|
||||||
|
.order(view_table::create_time.asc())
|
||||||
.into_boxed()
|
.into_boxed()
|
||||||
.load::<ViewTable>(conn)?;
|
.load::<ViewTable>(conn)?;
|
||||||
|
|
||||||
|
|
|
@ -32,16 +32,17 @@ impl WorkspaceTableSql {
|
||||||
user_id: &str,
|
user_id: &str,
|
||||||
conn: &SqliteConnection,
|
conn: &SqliteConnection,
|
||||||
) -> Result<Vec<WorkspaceTable>, WorkspaceError> {
|
) -> Result<Vec<WorkspaceTable>, WorkspaceError> {
|
||||||
let workspaces = match workspace_id {
|
let mut filter = dsl::workspace_table
|
||||||
None => dsl::workspace_table
|
.filter(workspace_table::user_id.eq(user_id))
|
||||||
.filter(workspace_table::user_id.eq(user_id))
|
.order(workspace_table::create_time.asc())
|
||||||
.load::<WorkspaceTable>(conn)?,
|
.into_boxed();
|
||||||
Some(workspace_id) => dsl::workspace_table
|
|
||||||
.filter(workspace_table::user_id.eq(user_id))
|
if let Some(workspace_id) = workspace_id {
|
||||||
.filter(workspace_table::id.eq(&workspace_id))
|
filter = filter.filter(workspace_table::id.eq(workspace_id.to_owned()));
|
||||||
.load::<WorkspaceTable>(conn)?,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let workspaces = filter.load::<WorkspaceTable>(conn)?;
|
||||||
|
|
||||||
Ok(workspaces)
|
Ok(workspaces)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue