mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
* chore: sync all data * chore: sync database row and document in the row * chore: sync inline view id * chore: sync row and document in row * fix: tests * fix: migrate document in row * chore: retry when create collab fail * fix: invalid secret cause rerun application * chore: fix clippy warnnings
67 lines
1.3 KiB
Rust
67 lines
1.3 KiB
Rust
use collab_database::rows::{RowDetail, RowId};
|
|
use collab_database::views::DatabaseLayout;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub enum DatabaseRowEvent {
|
|
InsertRow(InsertedRow),
|
|
UpdateRow(UpdatedRow),
|
|
DeleteRow(RowId),
|
|
Move {
|
|
deleted_row_id: RowId,
|
|
inserted_row: InsertedRow,
|
|
},
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct InsertedRow {
|
|
pub row_detail: RowDetail,
|
|
pub index: Option<i32>,
|
|
pub is_new: bool,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct UpdatedRow {
|
|
pub row_id: String,
|
|
|
|
pub height: Option<i32>,
|
|
|
|
/// Indicates which cells were updated.
|
|
pub field_ids: Vec<String>,
|
|
|
|
/// The meta of row was updated if this is Some.
|
|
pub row_detail: Option<RowDetail>,
|
|
}
|
|
|
|
impl UpdatedRow {
|
|
pub fn new(row_id: &str) -> Self {
|
|
Self {
|
|
row_id: row_id.to_string(),
|
|
height: None,
|
|
field_ids: vec![],
|
|
row_detail: None,
|
|
}
|
|
}
|
|
|
|
pub fn with_field_ids(mut self, field_ids: Vec<String>) -> Self {
|
|
self.field_ids = field_ids;
|
|
self
|
|
}
|
|
|
|
pub fn with_height(mut self, height: i32) -> Self {
|
|
self.height = Some(height);
|
|
self
|
|
}
|
|
|
|
pub fn with_row_meta(mut self, row_detail: RowDetail) -> Self {
|
|
self.row_detail = Some(row_detail);
|
|
self
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct CreateDatabaseViewParams {
|
|
pub name: String,
|
|
pub view_id: String,
|
|
pub layout_type: DatabaseLayout,
|
|
}
|