修改草稿另存为bug
All checks were successful
build / build-rust (push) Successful in 3m28s

This commit is contained in:
soul-walker 2024-09-20 15:31:11 +08:00
parent df4c9940f3
commit e8fa4d119c

View File

@ -178,6 +178,14 @@ impl CreateDraftData {
self
}
pub fn with_option_default_release_data_id(
mut self,
default_release_data_id: Option<i32>,
) -> 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?;