From b4d03c009792a6c1a5ace6478a8b3ec2a005fec5 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 20 Jun 2024 22:19:46 +0800 Subject: [PATCH] chore: update single select --- .../select_option_entities.rs | 19 +++++++++++++++++++ .../selection_type_option/select_option.rs | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/frontend/rust-lib/flowy-database2/src/entities/type_option_entities/select_option_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/type_option_entities/select_option_entities.rs index c5e931b017..0f3021a57e 100644 --- a/frontend/rust-lib/flowy-database2/src/entities/type_option_entities/select_option_entities.rs +++ b/frontend/rust-lib/flowy-database2/src/entities/type_option_entities/select_option_entities.rs @@ -211,6 +211,12 @@ pub struct SingleSelectTypeOptionPB { #[pb(index = 2)] pub disable_color: bool, + + #[pb(index = 3)] + ai_fill_enabled: bool, + + #[pb(index = 4)] + generated_options: Vec, } impl From for SingleSelectTypeOptionPB { @@ -222,6 +228,12 @@ impl From for SingleSelectTypeOptionPB { .map(|option| option.into()) .collect(), disable_color: data.disable_color, + ai_fill_enabled: data.ai_fill_enabled, + generated_options: data + .generated_options + .into_iter() + .map(|option| option.into()) + .collect(), } } } @@ -235,6 +247,13 @@ impl From for SingleSelectTypeOption { .map(|option| option.into()) .collect(), disable_color: data.disable_color, + version: 1, + ai_fill_enabled: data.ai_fill_enabled, + generated_options: data + .generated_options + .into_iter() + .map(|option| option.into()) + .collect(), } } } diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/select_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/select_option.rs index 4e359566a7..d9535cd1a5 100644 --- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/select_option.rs +++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/select_option.rs @@ -33,8 +33,8 @@ impl SelectOption { impl From for SelectOption { fn from(map: AnyMap) -> Self { SelectOption { - id: map.get_str("id").unwrap_or_default(), - name: map.get_str("name").unwrap_or_default(), + id: map.get_str_value("id").unwrap_or_default(), + name: map.get_str_value("name").unwrap_or_default(), color: SelectOptionColor::from(map.get_i64_value("color").unwrap_or(0)), } }