This commit is contained in:
@@ -125,6 +125,19 @@ impl From<module_runtime::RuntimeProfileWalletLedgerListInput>
|
||||
}
|
||||
}
|
||||
|
||||
impl From<module_runtime::RuntimeProfileWalletAdjustmentInput>
|
||||
for RuntimeProfileWalletAdjustmentInput
|
||||
{
|
||||
fn from(input: module_runtime::RuntimeProfileWalletAdjustmentInput) -> Self {
|
||||
Self {
|
||||
user_id: input.user_id,
|
||||
amount: input.amount,
|
||||
ledger_id: input.ledger_id,
|
||||
created_at_micros: input.created_at_micros,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<module_runtime::RuntimeProfileRechargeCenterGetInput>
|
||||
for RuntimeProfileRechargeCenterGetInput
|
||||
{
|
||||
@@ -663,6 +676,28 @@ pub(crate) fn map_runtime_profile_wallet_ledger_procedure_result(
|
||||
.collect())
|
||||
}
|
||||
|
||||
pub(crate) fn map_runtime_profile_wallet_adjustment_procedure_result(
|
||||
result: RuntimeProfileWalletAdjustmentProcedureResult,
|
||||
) -> Result<RuntimeProfileDashboardRecord, SpacetimeClientError> {
|
||||
if !result.ok {
|
||||
return Err(SpacetimeClientError::Procedure(
|
||||
result
|
||||
.error_message
|
||||
.unwrap_or_else(|| "SpacetimeDB procedure 返回未知错误".to_string()),
|
||||
));
|
||||
}
|
||||
|
||||
let snapshot = result.record.ok_or_else(|| {
|
||||
SpacetimeClientError::Procedure(
|
||||
"SpacetimeDB procedure 未返回 profile dashboard 快照".to_string(),
|
||||
)
|
||||
})?;
|
||||
|
||||
Ok(build_runtime_profile_dashboard_record(
|
||||
map_runtime_profile_dashboard_snapshot(snapshot),
|
||||
))
|
||||
}
|
||||
|
||||
pub(crate) fn map_runtime_profile_recharge_center_procedure_result(
|
||||
result: RuntimeProfileRechargeCenterProcedureResult,
|
||||
) -> Result<RuntimeProfileRechargeCenterRecord, SpacetimeClientError> {
|
||||
@@ -3236,6 +3271,12 @@ pub(crate) fn map_runtime_profile_wallet_ledger_source_type_back(
|
||||
crate::module_bindings::RuntimeProfileWalletLedgerSourceType::PointsRecharge => {
|
||||
module_runtime::RuntimeProfileWalletLedgerSourceType::PointsRecharge
|
||||
}
|
||||
crate::module_bindings::RuntimeProfileWalletLedgerSourceType::AssetGenerationConsume => {
|
||||
module_runtime::RuntimeProfileWalletLedgerSourceType::AssetGenerationConsume
|
||||
}
|
||||
crate::module_bindings::RuntimeProfileWalletLedgerSourceType::AssetGenerationRefund => {
|
||||
module_runtime::RuntimeProfileWalletLedgerSourceType::AssetGenerationRefund
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user