点赞和改造开关加入后台配置
This commit is contained in:
@@ -30,6 +30,17 @@ impl From<module_runtime::CreationEntryEventBannersAdminUpsertInput>
|
||||
}
|
||||
}
|
||||
|
||||
/// 将业务层公开作品互动配置保存输入转换为 SpacetimeDB 生成绑定类型。
|
||||
impl From<module_runtime::PublicWorkInteractionConfigAdminUpsertInput>
|
||||
for PublicWorkInteractionConfigAdminUpsertInput
|
||||
{
|
||||
fn from(input: module_runtime::PublicWorkInteractionConfigAdminUpsertInput) -> Self {
|
||||
Self {
|
||||
public_work_interactions_json: input.public_work_interactions_json,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<module_runtime::AdminWorkVisibilityListInput> for AdminWorkVisibilityListInput {
|
||||
fn from(input: module_runtime::AdminWorkVisibilityListInput) -> Self {
|
||||
Self {
|
||||
@@ -323,6 +334,7 @@ pub(crate) fn build_creation_entry_config_record_from_rows(
|
||||
})
|
||||
.collect(),
|
||||
updated_at_micros: header.updated_at.to_micros_since_unix_epoch(),
|
||||
public_work_interactions_json: header.public_work_interactions_json,
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -376,6 +388,7 @@ fn map_creation_entry_config_snapshot(
|
||||
})
|
||||
.collect(),
|
||||
updated_at_micros: snapshot.updated_at_micros,
|
||||
public_work_interactions_json: snapshot.public_work_interactions_json,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,6 +445,7 @@ mod tests {
|
||||
event_starts_at_text: None,
|
||||
event_ends_at_text: None,
|
||||
event_banners_json: None,
|
||||
public_work_interactions_json: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -514,6 +528,7 @@ mod tests {
|
||||
unified_creation_spec_json: None,
|
||||
}],
|
||||
updated_at_micros: 1_000_000,
|
||||
public_work_interactions_json: None,
|
||||
});
|
||||
|
||||
let jump_hop = record
|
||||
|
||||
@@ -591,6 +591,7 @@ pub mod public_work_detail_entry_table;
|
||||
pub mod public_work_detail_entry_type;
|
||||
pub mod public_work_gallery_entry_table;
|
||||
pub mod public_work_gallery_entry_type;
|
||||
pub mod public_work_interaction_config_admin_upsert_input_type;
|
||||
pub mod public_work_like_table;
|
||||
pub mod public_work_like_type;
|
||||
pub mod public_work_play_daily_stat_table;
|
||||
@@ -1022,6 +1023,7 @@ pub mod upsert_custom_world_profile_reducer;
|
||||
pub mod upsert_npc_state_and_return_procedure;
|
||||
pub mod upsert_npc_state_reducer;
|
||||
pub mod upsert_platform_browse_history_and_return_procedure;
|
||||
pub mod upsert_public_work_interaction_config_procedure;
|
||||
pub mod upsert_runtime_setting_and_return_procedure;
|
||||
pub mod upsert_runtime_snapshot_and_return_procedure;
|
||||
pub mod upsert_visual_novel_run_snapshot_procedure;
|
||||
@@ -1697,6 +1699,7 @@ pub use public_work_detail_entry_table::*;
|
||||
pub use public_work_detail_entry_type::PublicWorkDetailEntry;
|
||||
pub use public_work_gallery_entry_table::*;
|
||||
pub use public_work_gallery_entry_type::PublicWorkGalleryEntry;
|
||||
pub use public_work_interaction_config_admin_upsert_input_type::PublicWorkInteractionConfigAdminUpsertInput;
|
||||
pub use public_work_like_table::*;
|
||||
pub use public_work_like_type::PublicWorkLike;
|
||||
pub use public_work_play_daily_stat_table::*;
|
||||
@@ -2128,6 +2131,7 @@ pub use upsert_custom_world_profile_reducer::upsert_custom_world_profile;
|
||||
pub use upsert_npc_state_and_return_procedure::upsert_npc_state_and_return;
|
||||
pub use upsert_npc_state_reducer::upsert_npc_state;
|
||||
pub use upsert_platform_browse_history_and_return_procedure::upsert_platform_browse_history_and_return;
|
||||
pub use upsert_public_work_interaction_config_procedure::upsert_public_work_interaction_config;
|
||||
pub use upsert_runtime_setting_and_return_procedure::upsert_runtime_setting_and_return;
|
||||
pub use upsert_runtime_snapshot_and_return_procedure::upsert_runtime_snapshot_and_return;
|
||||
pub use upsert_visual_novel_run_snapshot_procedure::upsert_visual_novel_run_snapshot;
|
||||
|
||||
@@ -19,6 +19,7 @@ pub struct CreationEntryConfigSnapshot {
|
||||
pub event_banners_json: Option<String>,
|
||||
pub creation_types: Vec<CreationEntryTypeSnapshot>,
|
||||
pub updated_at_micros: i64,
|
||||
pub public_work_interactions_json: Option<String>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for CreationEntryConfigSnapshot {
|
||||
|
||||
@@ -22,6 +22,7 @@ pub struct CreationEntryConfig {
|
||||
pub event_starts_at_text: Option<String>,
|
||||
pub event_ends_at_text: Option<String>,
|
||||
pub event_banners_json: Option<String>,
|
||||
pub public_work_interactions_json: Option<String>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for CreationEntryConfig {
|
||||
@@ -47,6 +48,8 @@ pub struct CreationEntryConfigCols {
|
||||
pub event_starts_at_text: __sdk::__query_builder::Col<CreationEntryConfig, Option<String>>,
|
||||
pub event_ends_at_text: __sdk::__query_builder::Col<CreationEntryConfig, Option<String>>,
|
||||
pub event_banners_json: __sdk::__query_builder::Col<CreationEntryConfig, Option<String>>,
|
||||
pub public_work_interactions_json:
|
||||
__sdk::__query_builder::Col<CreationEntryConfig, Option<String>>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for CreationEntryConfig {
|
||||
@@ -77,6 +80,10 @@ impl __sdk::__query_builder::HasCols for CreationEntryConfig {
|
||||
),
|
||||
event_ends_at_text: __sdk::__query_builder::Col::new(table_name, "event_ends_at_text"),
|
||||
event_banners_json: __sdk::__query_builder::Col::new(table_name, "event_banners_json"),
|
||||
public_work_interactions_json: __sdk::__query_builder::Col::new(
|
||||
table_name,
|
||||
"public_work_interactions_json",
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +115,34 @@ impl SpacetimeClient {
|
||||
Ok(config)
|
||||
}
|
||||
|
||||
/// 调用 SpacetimeDB procedure 保存公开作品互动配置并刷新缓存。
|
||||
pub async fn upsert_public_work_interaction_config(
|
||||
&self,
|
||||
input: module_runtime::PublicWorkInteractionConfigAdminUpsertInput,
|
||||
) -> Result<CreationEntryConfigRecord, SpacetimeClientError> {
|
||||
let procedure_input: PublicWorkInteractionConfigAdminUpsertInput = input.into();
|
||||
let config = self
|
||||
.call_after_connect(
|
||||
"upsert_public_work_interaction_config",
|
||||
move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.upsert_public_work_interaction_config_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(SpacetimeClientError::from_sdk_error)
|
||||
.and_then(map_creation_entry_config_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
self.cache_creation_entry_config(config.clone()).await;
|
||||
Ok(config)
|
||||
}
|
||||
|
||||
pub async fn admin_list_work_visibility(
|
||||
&self,
|
||||
admin_user_id: String,
|
||||
|
||||
Reference in New Issue
Block a user