Feat/database view (#1875)

* chore: rename structs

* chore: add todos

* chore: hidden database id

* refactor: add database folder, prepare to extract the view

* refactor: rename grid-model to datbase-model

* ci: fix warnings
This commit is contained in:
Nathan.fooo
2023-02-21 15:47:51 +08:00
committed by GitHub
parent 346a09b2ae
commit f76d722b4c
160 changed files with 2152 additions and 1947 deletions

View File

@ -12,7 +12,6 @@ use flowy_sqlite::{
schema::{view_table, view_table::dsl},
SqliteConnection,
};
use folder_model::{ViewDataFormatRevision, ViewLayoutTypeRevision, ViewRevision};
use lib_infra::util::timestamp;
@ -111,7 +110,7 @@ impl ViewTable {
thumbnail: view_rev.thumbnail,
view_type: data_type,
ext_data: view_rev.ext_data,
version: view_rev.version,
version: 0,
is_trash: false,
}
}
@ -119,28 +118,24 @@ impl ViewTable {
impl std::convert::From<ViewTable> for ViewRevision {
fn from(table: ViewTable) -> Self {
let data_type = match table.view_type {
let data_format = match table.view_type {
SqlViewDataFormat::Delta => ViewDataFormatRevision::DeltaFormat,
SqlViewDataFormat::Database => ViewDataFormatRevision::DatabaseFormat,
SqlViewDataFormat::Tree => ViewDataFormatRevision::NodeFormat,
};
ViewRevision {
id: table.id,
app_id: table.belong_to_id,
name: table.name,
desc: table.desc,
data_format: data_type,
belongings: vec![],
modified_time: table.modified_time,
version: table.version,
create_time: table.create_time,
ext_data: "".to_string(),
thumbnail: table.thumbnail,
ViewRevision::new(
table.id,
table.belong_to_id,
table.name,
table.desc,
data_format,
// Store the view in ViewTable was deprecated since v0.0.2.
// No need to worry about layout.
layout: ViewLayoutTypeRevision::Document,
}
ViewLayoutTypeRevision::Document,
table.modified_time,
table.create_time,
)
}
}