From 09d61c79c99009747c902ad96e883592444747ce Mon Sep 17 00:00:00 2001 From: "Nathan.fooo" <86001920+appflowy@users.noreply.github.com> Date: Wed, 31 May 2023 17:34:41 +0800 Subject: [PATCH] chore: rename update at and create at (#2672) --- .../assets/translations/en.json | 4 ++-- .../cell/cell_controller_builder.dart | 4 ++-- .../application/database_controller.dart | 4 ++-- .../application/filter/filter_service.dart | 4 ++-- .../board/presentation/board_page.dart | 4 ++-- .../application/filter/filter_create_bloc.dart | 4 ++-- .../widgets/filter/filter_info.dart | 4 ++-- .../widgets/filter/filter_menu_item.dart | 4 ++-- .../widgets/header/field_type_extension.dart | 8 ++++---- .../widgets/header/type_option/builder.dart | 8 ++++---- .../widgets/card/card_cell_builder.dart | 4 ++-- .../widgets/row/cell_builder.dart | 4 ++-- .../database_view/widgets/row/row_detail.dart | 4 ++-- .../database/cell/controller_builder.ts | 4 ++-- .../src/entities/field_entities.rs | 14 +++++++------- .../src/entities/filter_entities/util.rs | 4 ++-- .../flowy-database2/src/entities/macros.rs | 4 ++-- .../src/services/cell/cell_operation.rs | 4 ++-- .../src/services/cell/type_cell_data.rs | 4 ++-- .../src/services/database/database_editor.rs | 2 +- .../date_type_option/date_type_option.rs | 2 +- .../services/field/type_options/type_option.rs | 6 +++--- .../field/type_options/type_option_cell.rs | 4 ++-- .../src/services/filter/controller.rs | 2 +- .../tests/database/block_test/row_test.rs | 6 +++--- .../tests/database/cell_test/test.rs | 4 ++-- .../tests/database/field_test/test.rs | 2 +- .../tests/database/field_test/util.rs | 4 ++-- .../database/mock_data/board_mock_data.rs | 16 ++++++++-------- .../tests/database/mock_data/grid_mock_data.rs | 18 +++++++++--------- .../tests/database/share_test/export_test.rs | 8 ++++---- 31 files changed, 84 insertions(+), 84 deletions(-) diff --git a/frontend/appflowy_flutter/assets/translations/en.json b/frontend/appflowy_flutter/assets/translations/en.json index 826dda7532..45d23aa9b8 100644 --- a/frontend/appflowy_flutter/assets/translations/en.json +++ b/frontend/appflowy_flutter/assets/translations/en.json @@ -280,8 +280,8 @@ "textFieldName": "Text", "checkboxFieldName": "Checkbox", "dateFieldName": "Date", - "updatedAtFieldName": "Updated At", - "createdAtFieldName": "Created At", + "updatedAtFieldName": "Last modified time", + "createdAtFieldName": "Created time", "numberFieldName": "Numbers", "singleSelectFieldName": "Select", "multiSelectFieldName": "Multiselect", diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/application/cell/cell_controller_builder.dart b/frontend/appflowy_flutter/lib/plugins/database_view/application/cell/cell_controller_builder.dart index 9174ffa9fb..c4a30d2361 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/application/cell/cell_controller_builder.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/application/cell/cell_controller_builder.dart @@ -40,8 +40,8 @@ class CellControllerBuilder { cellDataPersistence: TextCellDataPersistence(cellId: _cellId), ); case FieldType.DateTime: - case FieldType.UpdatedAt: - case FieldType.CreatedAt: + case FieldType.LastEditedTime: + case FieldType.CreatedTime: final cellDataLoader = CellDataLoader( cellId: _cellId, parser: DateCellDataParser(), diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dart b/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dart index 50c4edc215..546386dfe9 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dart @@ -356,8 +356,8 @@ class RowDataBuilder { assert( [ FieldType.DateTime, - FieldType.UpdatedAt, - FieldType.CreatedAt, + FieldType.LastEditedTime, + FieldType.CreatedTime, ].contains(fieldInfo.fieldType), ); final timestamp = date.millisecondsSinceEpoch ~/ 1000; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/application/filter/filter_service.dart b/frontend/appflowy_flutter/lib/plugins/database_view/application/filter/filter_service.dart index 083604b0a1..a0d2261dc8 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/application/filter/filter_service.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/application/filter/filter_service.dart @@ -92,8 +92,8 @@ class FilterBackendService { assert( [ FieldType.DateTime, - FieldType.UpdatedAt, - FieldType.CreatedAt, + FieldType.LastEditedTime, + FieldType.CreatedTime, ].contains(fieldType), ); diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/board/presentation/board_page.dart b/frontend/appflowy_flutter/lib/plugins/database_view/board/presentation/board_page.dart index 7ac5cc7124..616c332d0b 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/board/presentation/board_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/board/presentation/board_page.dart @@ -365,8 +365,8 @@ Widget? _buildHeaderIcon(GroupData customData) { } break; case FieldType.DateTime: - case FieldType.UpdatedAt: - case FieldType.CreatedAt: + case FieldType.LastEditedTime: + case FieldType.CreatedTime: break; case FieldType.MultiSelect: break; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/application/filter/filter_create_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/application/filter/filter_create_bloc.dart index e1676c1401..96d3d9e563 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/application/filter/filter_create_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/application/filter/filter_create_bloc.dart @@ -93,8 +93,8 @@ class GridCreateFilterBloc condition: CheckboxFilterConditionPB.IsChecked, ); case FieldType.DateTime: - case FieldType.UpdatedAt: - case FieldType.CreatedAt: + case FieldType.LastEditedTime: + case FieldType.CreatedTime: final timestamp = DateTime.now().millisecondsSinceEpoch ~/ 1000; return _filterBackendSvc.insertDateFilter( fieldId: fieldId, diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/filter/filter_info.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/filter/filter_info.dart index 2be27c8ef2..f8a6091cbf 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/filter/filter_info.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/filter/filter_info.dart @@ -25,8 +25,8 @@ class FilterInfo { DateFilterPB? dateFilter() { if (![ FieldType.DateTime, - FieldType.UpdatedAt, - FieldType.CreatedAt, + FieldType.LastEditedTime, + FieldType.CreatedTime, ].contains(filter.fieldType)) { return null; } diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/filter/filter_menu_item.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/filter/filter_menu_item.dart index 709f643e2b..d2e13b8b53 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/filter/filter_menu_item.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/filter/filter_menu_item.dart @@ -25,8 +25,8 @@ Widget buildFilterChoicechip(FilterInfo filterInfo) { case FieldType.Checkbox: return CheckboxFilterChoicechip(filterInfo: filterInfo); case FieldType.DateTime: - case FieldType.UpdatedAt: - case FieldType.CreatedAt: + case FieldType.LastEditedTime: + case FieldType.CreatedTime: return DateFilterChoicechip(filterInfo: filterInfo); case FieldType.MultiSelect: return SelectOptionFilterChoicechip(filterInfo: filterInfo); diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/field_type_extension.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/field_type_extension.dart index 52a18e97a2..848d750270 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/field_type_extension.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/field_type_extension.dart @@ -8,8 +8,8 @@ extension FieldTypeListExtension on FieldType { case FieldType.Checkbox: return "grid/field/checkbox"; case FieldType.DateTime: - case FieldType.UpdatedAt: - case FieldType.CreatedAt: + case FieldType.LastEditedTime: + case FieldType.CreatedTime: return "grid/field/date"; case FieldType.MultiSelect: return "grid/field/multi_select"; @@ -33,9 +33,9 @@ extension FieldTypeListExtension on FieldType { return LocaleKeys.grid_field_checkboxFieldName.tr(); case FieldType.DateTime: return LocaleKeys.grid_field_dateFieldName.tr(); - case FieldType.UpdatedAt: + case FieldType.LastEditedTime: return LocaleKeys.grid_field_updatedAtFieldName.tr(); - case FieldType.CreatedAt: + case FieldType.CreatedTime: return LocaleKeys.grid_field_createdAtFieldName.tr(); case FieldType.MultiSelect: return LocaleKeys.grid_field_multiSelectFieldName.tr(); diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/builder.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/builder.dart index 2a9cac24b5..fe61042135 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/builder.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/builder.dart @@ -73,8 +73,8 @@ TypeOptionWidgetBuilder makeTypeOptionWidgetBuilder({ ), ); case FieldType.DateTime: - case FieldType.UpdatedAt: - case FieldType.CreatedAt: + case FieldType.LastEditedTime: + case FieldType.CreatedTime: return DateTypeOptionWidgetBuilder( makeTypeOptionContextWithDataController( viewId: viewId, @@ -204,8 +204,8 @@ TypeOptionContext dataParser: CheckboxTypeOptionWidgetDataParser(), ) as TypeOptionContext; case FieldType.DateTime: - case FieldType.UpdatedAt: - case FieldType.CreatedAt: + case FieldType.LastEditedTime: + case FieldType.CreatedTime: return DateTypeOptionContext( dataController: dataController, dataParser: DateTypeOptionDataParser(), diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/card/card_cell_builder.dart b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/card/card_cell_builder.dart index 3d01d82def..d21ea1036f 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/card/card_cell_builder.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/card/card_cell_builder.dart @@ -39,8 +39,8 @@ class CardCellBuilder { key: key, ); case FieldType.DateTime: - case FieldType.UpdatedAt: - case FieldType.CreatedAt: + case FieldType.LastEditedTime: + case FieldType.CreatedTime: return DateCardCell( renderHook: renderHook?.renderHook[FieldType.DateTime], cellControllerBuilder: cellControllerBuilder, diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cell_builder.dart b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cell_builder.dart index ad64cee38d..02c654d332 100755 --- a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cell_builder.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cell_builder.dart @@ -39,8 +39,8 @@ class GridCellBuilder { key: key, style: style, ); - case FieldType.UpdatedAt: - case FieldType.CreatedAt: + case FieldType.LastEditedTime: + case FieldType.CreatedTime: return GridDateCell( cellControllerBuilder: cellControllerBuilder, key: key, diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/row_detail.dart b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/row_detail.dart index 106c8e3a52..c8f1cf5d91 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/row_detail.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/row_detail.dart @@ -337,8 +337,8 @@ GridCellStyle? _customCellStyle(FieldType fieldType) { case FieldType.Checkbox: return null; case FieldType.DateTime: - case FieldType.UpdatedAt: - case FieldType.CreatedAt: + case FieldType.LastEditedTime: + case FieldType.CreatedTime: return DateCellStyle( alignment: Alignment.centerLeft, ); diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/cell/controller_builder.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/cell/controller_builder.ts index 67e44a184a..bc1d5744e0 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/cell/controller_builder.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/cell/controller_builder.ts @@ -45,8 +45,8 @@ export class CellControllerBuilder { case FieldType.Number: return this.makeNumberCellController(); case FieldType.DateTime: - case FieldType.UpdatedAt: - case FieldType.CreatedAt: + case FieldType.LastEditedTime: + case FieldType.CreatedTime: return this.makeDateCellController(); case FieldType.URL: return this.makeURLCellController(); diff --git a/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs index 641298b1fa..3c37be826a 100644 --- a/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs +++ b/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs @@ -492,8 +492,8 @@ pub enum FieldType { Checkbox = 5, URL = 6, Checklist = 7, - UpdatedAt = 8, - CreatedAt = 9, + LastEditedTime = 8, + CreatedTime = 9, } pub const RICH_TEXT_FIELD: FieldType = FieldType::RichText; @@ -504,8 +504,8 @@ pub const MULTI_SELECT_FIELD: FieldType = FieldType::MultiSelect; pub const CHECKBOX_FIELD: FieldType = FieldType::Checkbox; pub const URL_FIELD: FieldType = FieldType::URL; pub const CHECKLIST_FIELD: FieldType = FieldType::Checklist; -pub const UPDATED_AT_FIELD: FieldType = FieldType::UpdatedAt; -pub const CREATED_AT_FIELD: FieldType = FieldType::CreatedAt; +pub const UPDATED_AT_FIELD: FieldType = FieldType::LastEditedTime; +pub const CREATED_AT_FIELD: FieldType = FieldType::CreatedTime; impl std::default::Default for FieldType { fn default() -> Self { @@ -539,7 +539,7 @@ impl FieldType { pub fn default_cell_width(&self) -> i32 { match self { - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => 180, + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => 180, _ => 150, } } @@ -554,8 +554,8 @@ impl FieldType { FieldType::Checkbox => "Checkbox", FieldType::URL => "URL", FieldType::Checklist => "Checklist", - FieldType::UpdatedAt => "Updated At", - FieldType::CreatedAt => "Created At", + FieldType::LastEditedTime => "Last edited time", + FieldType::CreatedTime => "Created time", }; s.to_string() } diff --git a/frontend/rust-lib/flowy-database2/src/entities/filter_entities/util.rs b/frontend/rust-lib/flowy-database2/src/entities/filter_entities/util.rs index aae8ba4c7f..cdc43c796b 100644 --- a/frontend/rust-lib/flowy-database2/src/entities/filter_entities/util.rs +++ b/frontend/rust-lib/flowy-database2/src/entities/filter_entities/util.rs @@ -35,7 +35,7 @@ impl std::convert::From<&Filter> for FilterPB { let bytes: Bytes = match filter.field_type { FieldType::RichText => TextFilterPB::from(filter).try_into().unwrap(), FieldType::Number => NumberFilterPB::from(filter).try_into().unwrap(), - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { DateFilterPB::from(filter).try_into().unwrap() }, FieldType::SingleSelect => SelectOptionFilterPB::from(filter).try_into().unwrap(), @@ -200,7 +200,7 @@ impl TryInto for UpdateFilterPayloadPB { condition = filter.condition as u8; content = filter.content; }, - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { let filter = DateFilterPB::try_from(bytes).map_err(|_| ErrorCode::ProtobufSerde)?; condition = filter.condition as u8; content = DateFilterContentPB { diff --git a/frontend/rust-lib/flowy-database2/src/entities/macros.rs b/frontend/rust-lib/flowy-database2/src/entities/macros.rs index e904f673e0..fd70e1a8f5 100644 --- a/frontend/rust-lib/flowy-database2/src/entities/macros.rs +++ b/frontend/rust-lib/flowy-database2/src/entities/macros.rs @@ -12,8 +12,8 @@ macro_rules! impl_into_field_type { 5 => FieldType::Checkbox, 6 => FieldType::URL, 7 => FieldType::Checklist, - 8 => FieldType::UpdatedAt, - 9 => FieldType::CreatedAt, + 8 => FieldType::LastEditedTime, + 9 => FieldType::CreatedTime, _ => { tracing::error!("Can't parser FieldType from value: {}", ty); FieldType::RichText diff --git a/frontend/rust-lib/flowy-database2/src/services/cell/cell_operation.rs b/frontend/rust-lib/flowy-database2/src/services/cell/cell_operation.rs index 4fef578a8d..3429328478 100644 --- a/frontend/rust-lib/flowy-database2/src/services/cell/cell_operation.rs +++ b/frontend/rust-lib/flowy-database2/src/services/cell/cell_operation.rs @@ -330,7 +330,7 @@ impl<'a> CellBuilder<'a> { cells.insert(field_id, insert_number_cell(num, field)); } }, - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { if let Ok(timestamp) = cell_str.parse::() { cells.insert(field_id, insert_date_cell(timestamp, Some(false), field)); } @@ -362,7 +362,7 @@ impl<'a> CellBuilder<'a> { for field in fields { if !cell_by_field_id.contains_key(&field.id) { let field_type = FieldType::from(field.field_type); - if field_type == FieldType::UpdatedAt || field_type == FieldType::CreatedAt { + if field_type == FieldType::LastEditedTime || field_type == FieldType::CreatedTime { cells.insert( field.id.clone(), insert_date_cell(timestamp(), Some(true), field), diff --git a/frontend/rust-lib/flowy-database2/src/services/cell/type_cell_data.rs b/frontend/rust-lib/flowy-database2/src/services/cell/type_cell_data.rs index 1144401765..b14c985395 100644 --- a/frontend/rust-lib/flowy-database2/src/services/cell/type_cell_data.rs +++ b/frontend/rust-lib/flowy-database2/src/services/cell/type_cell_data.rs @@ -82,8 +82,8 @@ impl TypeCellData { pub fn is_date(&self) -> bool { self.field_type == FieldType::DateTime - || self.field_type == FieldType::UpdatedAt - || self.field_type == FieldType::CreatedAt + || self.field_type == FieldType::LastEditedTime + || self.field_type == FieldType::CreatedTime } pub fn is_single_select(&self) -> bool { 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 e69bdb6f17..a8416929b0 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 @@ -514,7 +514,7 @@ impl DatabaseEditor { .lock() .get_fields(view_id, None) .into_iter() - .filter(|f| FieldType::from(f.field_type) == FieldType::UpdatedAt) + .filter(|f| FieldType::from(f.field_type) == FieldType::LastEditedTime) .collect::>(); self.database.lock().update_row(&row_id, |row_update| { diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_type_option.rs index 3b820c3dd3..b572427afe 100644 --- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_type_option.rs +++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_type_option.rs @@ -16,7 +16,7 @@ use serde::{Deserialize, Serialize}; use std::cmp::Ordering; use std::str::FromStr; -/// The [DateTypeOption] is used by [FieldType::Date], [FieldType::UpdatedAt], and [FieldType::CreatedAt]. +/// The [DateTypeOption] is used by [FieldType::Date], [FieldType::LastEditedTime], and [FieldType::CreatedTime]. /// So, storing the field type is necessary to distinguish the field type. /// Most of the cases, each [FieldType] has its own [TypeOption] implementation. #[derive(Clone, Default, Debug, Serialize, Deserialize)] diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option.rs index d00d1c70fc..220d4ab760 100644 --- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option.rs +++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option.rs @@ -146,7 +146,7 @@ pub fn type_option_data_from_pb_or_default>( FieldType::Number => { NumberTypeOptionPB::try_from(bytes).map(|pb| NumberTypeOption::from(pb).into()) }, - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { DateTypeOptionPB::try_from(bytes).map(|pb| DateTypeOption::from(pb).into()) }, FieldType::SingleSelect => { @@ -181,7 +181,7 @@ pub fn type_option_to_pb(type_option: TypeOptionData, field_type: &FieldType) -> .try_into() .unwrap() }, - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { let date_type_option: DateTypeOption = type_option.into(); DateTypeOptionPB::from(date_type_option).try_into().unwrap() }, @@ -220,7 +220,7 @@ pub fn default_type_option_data_from_type(field_type: &FieldType) -> TypeOptionD match field_type { FieldType::RichText => RichTextTypeOption::default().into(), FieldType::Number => NumberTypeOption::default().into(), - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => DateTypeOption { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => DateTypeOption { field_type: field_type.clone(), ..Default::default() } diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option_cell.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option_cell.rs index e8bc3c7000..8ebc6fd0f5 100644 --- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option_cell.rs +++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option_cell.rs @@ -352,7 +352,7 @@ impl<'a> TypeOptionCellExt<'a> { self.cell_data_cache.clone(), ) }), - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => self + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => self .field .get_type_option::(field_type) .map(|type_option| { @@ -472,7 +472,7 @@ fn get_type_option_transform_handler( FieldType::Number => { Box::new(NumberTypeOption::from(type_option_data)) as Box }, - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { Box::new(DateTypeOption::from(type_option_data)) as Box }, FieldType::SingleSelect => Box::new(SingleSelectTypeOption::from(type_option_data)) diff --git a/frontend/rust-lib/flowy-database2/src/services/filter/controller.rs b/frontend/rust-lib/flowy-database2/src/services/filter/controller.rs index 2a92c6987d..5062839ff5 100644 --- a/frontend/rust-lib/flowy-database2/src/services/filter/controller.rs +++ b/frontend/rust-lib/flowy-database2/src/services/filter/controller.rs @@ -325,7 +325,7 @@ impl FilterController { .write() .insert(field_id, NumberFilterPB::from_filter(filter.as_ref())); }, - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { self .cell_filter_cache .write() diff --git a/frontend/rust-lib/flowy-database2/tests/database/block_test/row_test.rs b/frontend/rust-lib/flowy-database2/tests/database/block_test/row_test.rs index eae6bb9ffe..fa7344b5e2 100644 --- a/frontend/rust-lib/flowy-database2/tests/database/block_test/row_test.rs +++ b/frontend/rust-lib/flowy-database2/tests/database/block_test/row_test.rs @@ -15,7 +15,7 @@ async fn created_at_field_test() { // Get created time of the new row. let row = test.get_rows().await.last().cloned().unwrap(); - let updated_at_field = test.get_first_field(FieldType::CreatedAt); + let updated_at_field = test.get_first_field(FieldType::CreatedTime); let cell = row.cells.cell_for_field_id(&updated_at_field.id).unwrap(); let created_at_timestamp = DateCellData::from(cell).timestamp.unwrap(); @@ -28,7 +28,7 @@ async fn created_at_field_test() { async fn update_at_field_test() { let mut test = DatabaseRowTest::new().await; let row = test.get_rows().await.remove(0); - let updated_at_field = test.get_first_field(FieldType::UpdatedAt); + let updated_at_field = test.get_first_field(FieldType::LastEditedTime); let cell = row.cells.cell_for_field_id(&updated_at_field.id).unwrap(); let old_updated_at = DateCellData::from(cell).timestamp.unwrap(); @@ -41,7 +41,7 @@ async fn update_at_field_test() { // Get the updated time of the row. let row = test.get_rows().await.remove(0); - let updated_at_field = test.get_first_field(FieldType::UpdatedAt); + let updated_at_field = test.get_first_field(FieldType::LastEditedTime); let cell = row.cells.cell_for_field_id(&updated_at_field.id).unwrap(); let new_updated_at = DateCellData::from(cell).timestamp.unwrap(); diff --git a/frontend/rust-lib/flowy-database2/tests/database/cell_test/test.rs b/frontend/rust-lib/flowy-database2/tests/database/cell_test/test.rs index c9b312612d..cdbcc71f6c 100644 --- a/frontend/rust-lib/flowy-database2/tests/database/cell_test/test.rs +++ b/frontend/rust-lib/flowy-database2/tests/database/cell_test/test.rs @@ -23,7 +23,7 @@ async fn grid_cell_update() { let cell_changeset = match field_type { FieldType::RichText => "".to_string(), FieldType::Number => "123".to_string(), - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { make_date_cell_string("123") }, FieldType::SingleSelect => { @@ -108,7 +108,7 @@ async fn url_cell_data_test() { #[tokio::test] async fn update_updated_at_field_on_other_cell_update() { let mut test = DatabaseCellTest::new().await; - let updated_at_field = test.get_first_field(FieldType::UpdatedAt); + let updated_at_field = test.get_first_field(FieldType::LastEditedTime); let text_field = test .fields diff --git a/frontend/rust-lib/flowy-database2/tests/database/field_test/test.rs b/frontend/rust-lib/flowy-database2/tests/database/field_test/test.rs index a4a22ec54a..94a8bbf437 100644 --- a/frontend/rust-lib/flowy-database2/tests/database/field_test/test.rs +++ b/frontend/rust-lib/flowy-database2/tests/database/field_test/test.rs @@ -31,7 +31,7 @@ async fn grid_create_field() { ]; test.run_scripts(scripts).await; - let (params, field) = create_date_field(&test.view_id(), FieldType::CreatedAt); + let (params, field) = create_date_field(&test.view_id(), FieldType::CreatedTime); let scripts = vec![ CreateField { params }, AssertFieldTypeOptionEqual { diff --git a/frontend/rust-lib/flowy-database2/tests/database/field_test/util.rs b/frontend/rust-lib/flowy-database2/tests/database/field_test/util.rs index f42684b347..2f671bc82a 100644 --- a/frontend/rust-lib/flowy-database2/tests/database/field_test/util.rs +++ b/frontend/rust-lib/flowy-database2/tests/database/field_test/util.rs @@ -55,11 +55,11 @@ pub fn create_date_field(grid_id: &str, field_type: FieldType) -> (CreateFieldPa .name("Date") .visibility(true) .build(), - FieldType::UpdatedAt => FieldBuilder::new(field_type.clone(), date_type_option.clone()) + FieldType::LastEditedTime => FieldBuilder::new(field_type.clone(), date_type_option.clone()) .name("Updated At") .visibility(true) .build(), - FieldType::CreatedAt => FieldBuilder::new(field_type.clone(), date_type_option.clone()) + FieldType::CreatedTime => FieldBuilder::new(field_type.clone(), date_type_option.clone()) .name("Created At") .visibility(true) .build(), 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 4437366f7e..75b88b26a9 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 @@ -37,7 +37,7 @@ pub fn make_test_board() -> DatabaseData { .build(); fields.push(number_field); }, - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { // Date let date_type_option = DateTypeOption { date_format: DateFormat::US, @@ -47,8 +47,8 @@ pub fn make_test_board() -> DatabaseData { }; let name = match field_type { FieldType::DateTime => "Time", - FieldType::UpdatedAt => "Updated At", - FieldType::CreatedAt => "Created At", + FieldType::LastEditedTime => "Updated At", + FieldType::CreatedTime => "Created At", _ => "", }; let date_field = FieldBuilder::new(field_type.clone(), date_type_option) @@ -126,7 +126,7 @@ pub fn make_test_board() -> DatabaseData { FieldType::RichText => row_builder.insert_text_cell("A"), FieldType::Number => row_builder.insert_number_cell("1"), // 1647251762 => Mar 14,2022 - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { row_builder.insert_date_cell("1647251762", None, None, &field_type) }, FieldType::SingleSelect => { @@ -146,7 +146,7 @@ pub fn make_test_board() -> DatabaseData { FieldType::RichText => row_builder.insert_text_cell("B"), FieldType::Number => row_builder.insert_number_cell("2"), // 1647251762 => Mar 14,2022 - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { row_builder.insert_date_cell("1647251762", None, None, &field_type) }, FieldType::SingleSelect => { @@ -165,7 +165,7 @@ pub fn make_test_board() -> DatabaseData { FieldType::RichText => row_builder.insert_text_cell("C"), FieldType::Number => row_builder.insert_number_cell("3"), // 1647251762 => Mar 14,2022 - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { row_builder.insert_date_cell("1647251762", None, None, &field_type) }, FieldType::SingleSelect => { @@ -187,7 +187,7 @@ pub fn make_test_board() -> DatabaseData { match field_type { FieldType::RichText => row_builder.insert_text_cell("DA"), FieldType::Number => row_builder.insert_number_cell("4"), - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { row_builder.insert_date_cell("1668704685", None, None, &field_type) }, FieldType::SingleSelect => { @@ -204,7 +204,7 @@ pub fn make_test_board() -> DatabaseData { match field_type { FieldType::RichText => row_builder.insert_text_cell("AE"), FieldType::Number => row_builder.insert_number_cell(""), - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { row_builder.insert_date_cell("1668359085", None, None, &field_type) }, FieldType::SingleSelect => { 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 e144878a25..dd980db835 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 @@ -37,7 +37,7 @@ pub fn make_test_grid() -> DatabaseData { .build(); fields.push(number_field); }, - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { // Date let date_type_option = DateTypeOption { date_format: DateFormat::US, @@ -47,8 +47,8 @@ pub fn make_test_grid() -> DatabaseData { }; let name = match field_type { FieldType::DateTime => "Time", - FieldType::UpdatedAt => "Updated At", - FieldType::CreatedAt => "Created At", + FieldType::LastEditedTime => "Updated At", + FieldType::CreatedTime => "Created At", _ => "", }; let date_field = FieldBuilder::new(field_type.clone(), date_type_option) @@ -124,7 +124,7 @@ pub fn make_test_grid() -> DatabaseData { match field_type { FieldType::RichText => row_builder.insert_text_cell("A"), FieldType::Number => row_builder.insert_number_cell("1"), - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { row_builder.insert_date_cell("1647251762", None, None, &field_type) }, FieldType::MultiSelect => row_builder @@ -145,7 +145,7 @@ pub fn make_test_grid() -> DatabaseData { match field_type { FieldType::RichText => row_builder.insert_text_cell(""), FieldType::Number => row_builder.insert_number_cell("2"), - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { row_builder.insert_date_cell("1647251762", None, None, &field_type) }, FieldType::MultiSelect => row_builder @@ -160,7 +160,7 @@ pub fn make_test_grid() -> DatabaseData { match field_type { FieldType::RichText => row_builder.insert_text_cell("C"), FieldType::Number => row_builder.insert_number_cell("3"), - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { row_builder.insert_date_cell("1647251762", None, None, &field_type) }, FieldType::SingleSelect => { @@ -179,7 +179,7 @@ pub fn make_test_grid() -> DatabaseData { match field_type { FieldType::RichText => row_builder.insert_text_cell("DA"), FieldType::Number => row_builder.insert_number_cell("14"), - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { row_builder.insert_date_cell("1668704685", None, None, &field_type) }, FieldType::SingleSelect => { @@ -195,7 +195,7 @@ pub fn make_test_grid() -> DatabaseData { match field_type { FieldType::RichText => row_builder.insert_text_cell("AE"), FieldType::Number => row_builder.insert_number_cell(""), - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { row_builder.insert_date_cell("1668359085", None, None, &field_type) }, FieldType::SingleSelect => { @@ -212,7 +212,7 @@ pub fn make_test_grid() -> DatabaseData { match field_type { FieldType::RichText => row_builder.insert_text_cell("AE"), FieldType::Number => row_builder.insert_number_cell("5"), - FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => { + FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => { row_builder.insert_date_cell("1671938394", None, None, &field_type) }, FieldType::SingleSelect => { diff --git a/frontend/rust-lib/flowy-database2/tests/database/share_test/export_test.rs b/frontend/rust-lib/flowy-database2/tests/database/share_test/export_test.rs index 684763a045..6933b9eb0f 100644 --- a/frontend/rust-lib/flowy-database2/tests/database/share_test/export_test.rs +++ b/frontend/rust-lib/flowy-database2/tests/database/share_test/export_test.rs @@ -96,8 +96,8 @@ async fn export_and_then_import_meta_csv_test() { FieldType::Checkbox => {}, FieldType::URL => {}, FieldType::Checklist => {}, - FieldType::UpdatedAt => {}, - FieldType::CreatedAt => {}, + FieldType::LastEditedTime => {}, + FieldType::CreatedTime => {}, } } else { panic!( @@ -177,8 +177,8 @@ async fn history_database_import_test() { } }, FieldType::Checklist => {}, - FieldType::UpdatedAt => {}, - FieldType::CreatedAt => {}, + FieldType::LastEditedTime => {}, + FieldType::CreatedTime => {}, } } else { panic!(