From e8fa4d119cfc7daba768a42ea17cf29843245380 Mon Sep 17 00:00:00 2001 From: soul-walker <31162815+soul-walker@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:31:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8D=89=E7=A8=BF=E5=8F=A6?= =?UTF-8?q?=E5=AD=98=E4=B8=BAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/rtss_db/src/db_access/draft_data.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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?;