diff --git a/crates/rtss_db/src/db_access/draft_data.rs b/crates/rtss_db/src/db_access/draft_data.rs index 9d93d07..b168e80 100644 --- a/crates/rtss_db/src/db_access/draft_data.rs +++ b/crates/rtss_db/src/db_access/draft_data.rs @@ -178,6 +178,14 @@ impl CreateDraftData { self } + pub fn with_option_default_release_data_id( + mut self, + default_release_data_id: Option, + ) -> Self { + self.default_release_data_id = default_release_data_id; + self + } + pub fn with_default_release_data_id(mut self, default_release_data_id: i32) -> Self { self.default_release_data_id = Some(default_release_data_id); self @@ -400,7 +408,10 @@ impl DraftDataAccessor for RtssDbAccessor { DataType::try_from(draft_data.data_type).unwrap(), user_id, ) - .with_data(draft_data.data.as_ref().unwrap()); + .with_option_options(draft_data.options) + .with_data(draft_data.data.as_ref().unwrap()) + .with_option_default_release_data_id(draft_data.default_release_data_id); + self.create_draft_data(create).await } } @@ -472,7 +483,12 @@ mod tests { println!("{:?}", new_draft); assert_eq!(new_draft.name, "new draft"); assert_eq!(new_draft.user_id, 11); + assert_eq!(new_draft.options, res.options); assert_eq!(new_draft.data.unwrap(), data); + assert_eq!( + new_draft.default_release_data_id, + res.default_release_data_id + ); // delete测试 accessor.delete_draft_data(&[res.id, new_draft.id]).await?;