feat: move creation entry config to database
This commit is contained in:
@@ -705,6 +705,58 @@ pub(crate) fn map_asset_history_list_result(
|
||||
.collect())
|
||||
}
|
||||
|
||||
pub type CreationEntryConfigRecord = shared_contracts::creation_entry_config::CreationEntryConfigResponse;
|
||||
|
||||
pub(crate) fn map_creation_entry_config_procedure_result(
|
||||
result: CreationEntryConfigProcedureResult,
|
||||
) -> Result<CreationEntryConfigRecord, SpacetimeClientError> {
|
||||
if !result.ok {
|
||||
return Err(SpacetimeClientError::procedure_failed(result.error_message));
|
||||
}
|
||||
|
||||
let snapshot = result
|
||||
.record
|
||||
.ok_or_else(|| SpacetimeClientError::missing_snapshot("创作入口配置快照"))?;
|
||||
|
||||
Ok(module_runtime::build_creation_entry_config_response(
|
||||
map_creation_entry_config_snapshot(snapshot),
|
||||
))
|
||||
}
|
||||
|
||||
fn map_creation_entry_config_snapshot(
|
||||
snapshot: CreationEntryConfigSnapshot,
|
||||
) -> module_runtime::CreationEntryConfigSnapshot {
|
||||
module_runtime::CreationEntryConfigSnapshot {
|
||||
config_id: snapshot.config_id,
|
||||
start_card: module_runtime::CreationEntryStartCardSnapshot {
|
||||
title: snapshot.start_card.title,
|
||||
description: snapshot.start_card.description,
|
||||
idle_badge: snapshot.start_card.idle_badge,
|
||||
busy_badge: snapshot.start_card.busy_badge,
|
||||
},
|
||||
type_modal: module_runtime::CreationEntryTypeModalSnapshot {
|
||||
title: snapshot.type_modal.title,
|
||||
description: snapshot.type_modal.description,
|
||||
},
|
||||
creation_types: snapshot
|
||||
.creation_types
|
||||
.into_iter()
|
||||
.map(|item| module_runtime::CreationEntryTypeSnapshot {
|
||||
id: item.id,
|
||||
title: item.title,
|
||||
subtitle: item.subtitle,
|
||||
badge: item.badge,
|
||||
image_src: item.image_src,
|
||||
visible: item.visible,
|
||||
open: item.open,
|
||||
sort_order: item.sort_order,
|
||||
updated_at_micros: item.updated_at_micros,
|
||||
})
|
||||
.collect(),
|
||||
updated_at_micros: snapshot.updated_at_micros,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn map_runtime_setting_procedure_result(
|
||||
result: RuntimeSettingProcedureResult,
|
||||
) -> Result<RuntimeSettingsRecord, SpacetimeClientError> {
|
||||
|
||||
Reference in New Issue
Block a user