This commit is contained in:
2026-05-15 06:36:48 +08:00
620 changed files with 126075 additions and 6322 deletions

View File

@@ -165,7 +165,7 @@ use module_runtime::{
RuntimePlatformTheme as DomainRuntimePlatformTheme, RuntimeProfileDashboardRecord,
RuntimeProfileFeedbackSubmissionRecord, RuntimeProfileInviteCodeRecord,
RuntimeProfilePlayStatsRecord, RuntimeProfileRechargeCenterRecord,
RuntimeProfileRechargeOrderRecord,
RuntimeProfileRechargeOrderRecord, RuntimeProfileRechargeProductConfigRecord,
RuntimeProfileRedeemCodeMode as DomainRuntimeProfileRedeemCodeMode,
RuntimeProfileRedeemCodeRecord, RuntimeProfileRewardCodeRedeemRecord,
RuntimeProfileSaveArchiveRecord, RuntimeProfileTaskCenterRecord, RuntimeProfileTaskClaimRecord,
@@ -185,6 +185,9 @@ use module_runtime::{
build_runtime_profile_recharge_center_get_input, build_runtime_profile_recharge_center_record,
build_runtime_profile_recharge_order_create_input,
build_runtime_profile_recharge_order_get_input,
build_runtime_profile_recharge_product_admin_list_input,
build_runtime_profile_recharge_product_admin_upsert_input,
build_runtime_profile_recharge_product_config_record,
build_runtime_profile_redeem_code_admin_disable_input,
build_runtime_profile_redeem_code_admin_list_input,
build_runtime_profile_redeem_code_admin_upsert_input, build_runtime_profile_redeem_code_record,

View File

@@ -309,6 +309,39 @@ impl From<module_runtime::RuntimeProfileTaskConfigAdminDisableInput>
}
}
impl From<module_runtime::RuntimeProfileRechargeProductAdminListInput>
for RuntimeProfileRechargeProductAdminListInput
{
fn from(input: module_runtime::RuntimeProfileRechargeProductAdminListInput) -> Self {
Self {
admin_user_id: input.admin_user_id,
}
}
}
impl From<module_runtime::RuntimeProfileRechargeProductAdminUpsertInput>
for RuntimeProfileRechargeProductAdminUpsertInput
{
fn from(input: module_runtime::RuntimeProfileRechargeProductAdminUpsertInput) -> Self {
Self {
admin_user_id: input.admin_user_id,
product_id: input.product_id,
title: input.title,
price_cents: input.price_cents,
kind: map_runtime_profile_recharge_product_kind(input.kind),
points_amount: input.points_amount,
bonus_points: input.bonus_points,
duration_days: input.duration_days,
badge_label: input.badge_label,
description: input.description,
tier: map_runtime_profile_membership_tier(input.tier),
enabled: input.enabled,
sort_order: input.sort_order,
updated_at_micros: input.updated_at_micros,
}
}
}
impl From<module_runtime::RuntimeProfileRedeemCodeAdminUpsertInput>
for RuntimeProfileRedeemCodeAdminUpsertInput
{
@@ -1157,6 +1190,40 @@ pub(crate) fn map_runtime_profile_task_config_admin_procedure_result(
))
}
pub(crate) fn map_runtime_profile_recharge_product_admin_list_procedure_result(
result: RuntimeProfileRechargeProductAdminListProcedureResult,
) -> Result<Vec<RuntimeProfileRechargeProductConfigRecord>, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
Ok(result
.entries
.into_iter()
.map(|snapshot| {
build_runtime_profile_recharge_product_config_record(
map_runtime_profile_recharge_product_config_snapshot(snapshot),
)
})
.collect())
}
pub(crate) fn map_runtime_profile_recharge_product_admin_procedure_result(
result: RuntimeProfileRechargeProductAdminProcedureResult,
) -> Result<RuntimeProfileRechargeProductConfigRecord, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
let snapshot = result
.record
.ok_or_else(|| SpacetimeClientError::missing_snapshot("recharge product config 快照"))?;
Ok(build_runtime_profile_recharge_product_config_record(
map_runtime_profile_recharge_product_config_snapshot(snapshot),
))
}
pub(crate) fn map_runtime_profile_redeem_code_admin_procedure_result(
result: RuntimeProfileRedeemCodeAdminProcedureResult,
) -> Result<RuntimeProfileRedeemCodeRecord, SpacetimeClientError> {
@@ -2237,6 +2304,29 @@ pub(crate) fn map_runtime_profile_recharge_product_snapshot(
}
}
pub(crate) fn map_runtime_profile_recharge_product_config_snapshot(
snapshot: RuntimeProfileRechargeProductConfigSnapshot,
) -> module_runtime::RuntimeProfileRechargeProductConfigSnapshot {
module_runtime::RuntimeProfileRechargeProductConfigSnapshot {
product_id: snapshot.product_id,
title: snapshot.title,
price_cents: snapshot.price_cents,
kind: map_runtime_profile_recharge_product_kind_back(snapshot.kind),
points_amount: snapshot.points_amount,
bonus_points: snapshot.bonus_points,
duration_days: snapshot.duration_days,
badge_label: snapshot.badge_label,
description: snapshot.description,
tier: map_runtime_profile_membership_tier_back(snapshot.tier),
enabled: snapshot.enabled,
sort_order: snapshot.sort_order,
created_by: snapshot.created_by,
created_at_micros: snapshot.created_at_micros,
updated_by: snapshot.updated_by,
updated_at_micros: snapshot.updated_at_micros,
}
}
pub(crate) fn map_runtime_profile_membership_benefit_snapshot(
snapshot: RuntimeProfileMembershipBenefitSnapshot,
) -> module_runtime::RuntimeProfileMembershipBenefitSnapshot {
@@ -5037,6 +5127,19 @@ pub(crate) fn map_runtime_profile_redeem_code_mode_back(
}
}
pub(crate) fn map_runtime_profile_recharge_product_kind(
value: module_runtime::RuntimeProfileRechargeProductKind,
) -> crate::module_bindings::RuntimeProfileRechargeProductKind {
match value {
module_runtime::RuntimeProfileRechargeProductKind::Points => {
crate::module_bindings::RuntimeProfileRechargeProductKind::Points
}
module_runtime::RuntimeProfileRechargeProductKind::Membership => {
crate::module_bindings::RuntimeProfileRechargeProductKind::Membership
}
}
}
pub(crate) fn map_runtime_profile_recharge_product_kind_back(
value: crate::module_bindings::RuntimeProfileRechargeProductKind,
) -> module_runtime::RuntimeProfileRechargeProductKind {
@@ -5050,6 +5153,25 @@ pub(crate) fn map_runtime_profile_recharge_product_kind_back(
}
}
pub(crate) fn map_runtime_profile_membership_tier(
value: module_runtime::RuntimeProfileMembershipTier,
) -> crate::module_bindings::RuntimeProfileMembershipTier {
match value {
module_runtime::RuntimeProfileMembershipTier::Normal => {
crate::module_bindings::RuntimeProfileMembershipTier::Normal
}
module_runtime::RuntimeProfileMembershipTier::Month => {
crate::module_bindings::RuntimeProfileMembershipTier::Month
}
module_runtime::RuntimeProfileMembershipTier::Season => {
crate::module_bindings::RuntimeProfileMembershipTier::Season
}
module_runtime::RuntimeProfileMembershipTier::Year => {
crate::module_bindings::RuntimeProfileMembershipTier::Year
}
}
}
pub(crate) fn map_runtime_profile_membership_status_back(
value: crate::module_bindings::RuntimeProfileMembershipStatus,
) -> module_runtime::RuntimeProfileMembershipStatus {

View File

@@ -0,0 +1,61 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::runtime_profile_recharge_product_admin_list_input_type::RuntimeProfileRechargeProductAdminListInput;
use super::runtime_profile_recharge_product_admin_list_procedure_result_type::RuntimeProfileRechargeProductAdminListProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct AdminListProfileRechargeProductsArgs {
pub input: RuntimeProfileRechargeProductAdminListInput,
}
impl __sdk::InModule for AdminListProfileRechargeProductsArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `admin_list_profile_recharge_products`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait admin_list_profile_recharge_products {
fn admin_list_profile_recharge_products(
&self,
input: RuntimeProfileRechargeProductAdminListInput,
) {
self.admin_list_profile_recharge_products_then(input, |_, _| {});
}
fn admin_list_profile_recharge_products_then(
&self,
input: RuntimeProfileRechargeProductAdminListInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<RuntimeProfileRechargeProductAdminListProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl admin_list_profile_recharge_products for super::RemoteProcedures {
fn admin_list_profile_recharge_products_then(
&self,
input: RuntimeProfileRechargeProductAdminListInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<RuntimeProfileRechargeProductAdminListProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp.invoke_procedure_with_callback::<_, RuntimeProfileRechargeProductAdminListProcedureResult>(
"admin_list_profile_recharge_products",
AdminListProfileRechargeProductsArgs { input, },
__callback,
);
}
}

View File

@@ -0,0 +1,62 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::runtime_profile_recharge_product_admin_procedure_result_type::RuntimeProfileRechargeProductAdminProcedureResult;
use super::runtime_profile_recharge_product_admin_upsert_input_type::RuntimeProfileRechargeProductAdminUpsertInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct AdminUpsertProfileRechargeProductArgs {
pub input: RuntimeProfileRechargeProductAdminUpsertInput,
}
impl __sdk::InModule for AdminUpsertProfileRechargeProductArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `admin_upsert_profile_recharge_product`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait admin_upsert_profile_recharge_product {
fn admin_upsert_profile_recharge_product(
&self,
input: RuntimeProfileRechargeProductAdminUpsertInput,
) {
self.admin_upsert_profile_recharge_product_then(input, |_, _| {});
}
fn admin_upsert_profile_recharge_product_then(
&self,
input: RuntimeProfileRechargeProductAdminUpsertInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<RuntimeProfileRechargeProductAdminProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl admin_upsert_profile_recharge_product for super::RemoteProcedures {
fn admin_upsert_profile_recharge_product_then(
&self,
input: RuntimeProfileRechargeProductAdminUpsertInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<RuntimeProfileRechargeProductAdminProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, RuntimeProfileRechargeProductAdminProcedureResult>(
"admin_upsert_profile_recharge_product",
AdminUpsertProfileRechargeProductArgs { input },
__callback,
);
}
}

View File

@@ -11,9 +11,11 @@ pub mod acknowledge_quest_completion_reducer;
pub mod admin_disable_profile_redeem_code_procedure;
pub mod admin_disable_profile_task_config_procedure;
pub mod admin_list_profile_invite_codes_procedure;
pub mod admin_list_profile_recharge_products_procedure;
pub mod admin_list_profile_redeem_codes_procedure;
pub mod admin_list_profile_task_configs_procedure;
pub mod admin_upsert_profile_invite_code_procedure;
pub mod admin_upsert_profile_recharge_product_procedure;
pub mod admin_upsert_profile_redeem_code_procedure;
pub mod admin_upsert_profile_task_config_procedure;
pub mod advance_puzzle_next_level_procedure;
@@ -461,6 +463,8 @@ pub mod profile_played_world_table;
pub mod profile_played_world_type;
pub mod profile_recharge_order_table;
pub mod profile_recharge_order_type;
pub mod profile_recharge_product_config_table;
pub mod profile_recharge_product_config_type;
pub mod profile_redeem_code_table;
pub mod profile_redeem_code_type;
pub mod profile_redeem_code_usage_table;
@@ -652,6 +656,11 @@ pub mod runtime_profile_recharge_order_get_input_type;
pub mod runtime_profile_recharge_order_paid_input_type;
pub mod runtime_profile_recharge_order_snapshot_type;
pub mod runtime_profile_recharge_order_status_type;
pub mod runtime_profile_recharge_product_admin_list_input_type;
pub mod runtime_profile_recharge_product_admin_list_procedure_result_type;
pub mod runtime_profile_recharge_product_admin_procedure_result_type;
pub mod runtime_profile_recharge_product_admin_upsert_input_type;
pub mod runtime_profile_recharge_product_config_snapshot_type;
pub mod runtime_profile_recharge_product_kind_type;
pub mod runtime_profile_recharge_product_snapshot_type;
pub mod runtime_profile_redeem_code_admin_disable_input_type;
@@ -857,9 +866,11 @@ pub use acknowledge_quest_completion_reducer::acknowledge_quest_completion;
pub use admin_disable_profile_redeem_code_procedure::admin_disable_profile_redeem_code;
pub use admin_disable_profile_task_config_procedure::admin_disable_profile_task_config;
pub use admin_list_profile_invite_codes_procedure::admin_list_profile_invite_codes;
pub use admin_list_profile_recharge_products_procedure::admin_list_profile_recharge_products;
pub use admin_list_profile_redeem_codes_procedure::admin_list_profile_redeem_codes;
pub use admin_list_profile_task_configs_procedure::admin_list_profile_task_configs;
pub use admin_upsert_profile_invite_code_procedure::admin_upsert_profile_invite_code;
pub use admin_upsert_profile_recharge_product_procedure::admin_upsert_profile_recharge_product;
pub use admin_upsert_profile_redeem_code_procedure::admin_upsert_profile_redeem_code;
pub use admin_upsert_profile_task_config_procedure::admin_upsert_profile_task_config;
pub use advance_puzzle_next_level_procedure::advance_puzzle_next_level;
@@ -1307,6 +1318,8 @@ pub use profile_played_world_table::*;
pub use profile_played_world_type::ProfilePlayedWorld;
pub use profile_recharge_order_table::*;
pub use profile_recharge_order_type::ProfileRechargeOrder;
pub use profile_recharge_product_config_table::*;
pub use profile_recharge_product_config_type::ProfileRechargeProductConfig;
pub use profile_redeem_code_table::*;
pub use profile_redeem_code_type::ProfileRedeemCode;
pub use profile_redeem_code_usage_table::*;
@@ -1498,6 +1511,11 @@ pub use runtime_profile_recharge_order_get_input_type::RuntimeProfileRechargeOrd
pub use runtime_profile_recharge_order_paid_input_type::RuntimeProfileRechargeOrderPaidInput;
pub use runtime_profile_recharge_order_snapshot_type::RuntimeProfileRechargeOrderSnapshot;
pub use runtime_profile_recharge_order_status_type::RuntimeProfileRechargeOrderStatus;
pub use runtime_profile_recharge_product_admin_list_input_type::RuntimeProfileRechargeProductAdminListInput;
pub use runtime_profile_recharge_product_admin_list_procedure_result_type::RuntimeProfileRechargeProductAdminListProcedureResult;
pub use runtime_profile_recharge_product_admin_procedure_result_type::RuntimeProfileRechargeProductAdminProcedureResult;
pub use runtime_profile_recharge_product_admin_upsert_input_type::RuntimeProfileRechargeProductAdminUpsertInput;
pub use runtime_profile_recharge_product_config_snapshot_type::RuntimeProfileRechargeProductConfigSnapshot;
pub use runtime_profile_recharge_product_kind_type::RuntimeProfileRechargeProductKind;
pub use runtime_profile_recharge_product_snapshot_type::RuntimeProfileRechargeProductSnapshot;
pub use runtime_profile_redeem_code_admin_disable_input_type::RuntimeProfileRedeemCodeAdminDisableInput;
@@ -2020,6 +2038,7 @@ pub struct DbUpdate {
profile_membership: __sdk::TableUpdate<ProfileMembership>,
profile_played_world: __sdk::TableUpdate<ProfilePlayedWorld>,
profile_recharge_order: __sdk::TableUpdate<ProfileRechargeOrder>,
profile_recharge_product_config: __sdk::TableUpdate<ProfileRechargeProductConfig>,
profile_redeem_code: __sdk::TableUpdate<ProfileRedeemCode>,
profile_redeem_code_usage: __sdk::TableUpdate<ProfileRedeemCodeUsage>,
profile_referral_relation: __sdk::TableUpdate<ProfileReferralRelation>,
@@ -2224,6 +2243,11 @@ impl TryFrom<__ws::v2::TransactionUpdate> for DbUpdate {
"profile_recharge_order" => db_update.profile_recharge_order.append(
profile_recharge_order_table::parse_table_update(table_update)?,
),
"profile_recharge_product_config" => {
db_update.profile_recharge_product_config.append(
profile_recharge_product_config_table::parse_table_update(table_update)?,
)
}
"profile_redeem_code" => db_update
.profile_redeem_code
.append(profile_redeem_code_table::parse_table_update(table_update)?),
@@ -2627,6 +2651,12 @@ impl __sdk::DbUpdate for DbUpdate {
&self.profile_recharge_order,
)
.with_updates_by_pk(|row| &row.order_id);
diff.profile_recharge_product_config = cache
.apply_diff_to_table::<ProfileRechargeProductConfig>(
"profile_recharge_product_config",
&self.profile_recharge_product_config,
)
.with_updates_by_pk(|row| &row.product_id);
diff.profile_redeem_code = cache
.apply_diff_to_table::<ProfileRedeemCode>(
"profile_redeem_code",
@@ -2969,6 +2999,9 @@ impl __sdk::DbUpdate for DbUpdate {
"profile_recharge_order" => db_update
.profile_recharge_order
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
"profile_recharge_product_config" => db_update
.profile_recharge_product_config
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
"profile_redeem_code" => db_update
.profile_redeem_code
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
@@ -3246,6 +3279,9 @@ impl __sdk::DbUpdate for DbUpdate {
"profile_recharge_order" => db_update
.profile_recharge_order
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
"profile_recharge_product_config" => db_update
.profile_recharge_product_config
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
"profile_redeem_code" => db_update
.profile_redeem_code
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
@@ -3427,6 +3463,7 @@ pub struct AppliedDiff<'r> {
profile_membership: __sdk::TableAppliedDiff<'r, ProfileMembership>,
profile_played_world: __sdk::TableAppliedDiff<'r, ProfilePlayedWorld>,
profile_recharge_order: __sdk::TableAppliedDiff<'r, ProfileRechargeOrder>,
profile_recharge_product_config: __sdk::TableAppliedDiff<'r, ProfileRechargeProductConfig>,
profile_redeem_code: __sdk::TableAppliedDiff<'r, ProfileRedeemCode>,
profile_redeem_code_usage: __sdk::TableAppliedDiff<'r, ProfileRedeemCodeUsage>,
profile_referral_relation: __sdk::TableAppliedDiff<'r, ProfileReferralRelation>,
@@ -3717,6 +3754,11 @@ impl<'r> __sdk::AppliedDiff<'r> for AppliedDiff<'r> {
&self.profile_recharge_order,
event,
);
callbacks.invoke_table_row_callbacks::<ProfileRechargeProductConfig>(
"profile_recharge_product_config",
&self.profile_recharge_product_config,
event,
);
callbacks.invoke_table_row_callbacks::<ProfileRedeemCode>(
"profile_redeem_code",
&self.profile_redeem_code,
@@ -4609,6 +4651,7 @@ impl __sdk::SpacetimeModule for RemoteModule {
profile_membership_table::register_table(client_cache);
profile_played_world_table::register_table(client_cache);
profile_recharge_order_table::register_table(client_cache);
profile_recharge_product_config_table::register_table(client_cache);
profile_redeem_code_table::register_table(client_cache);
profile_redeem_code_usage_table::register_table(client_cache);
profile_referral_relation_table::register_table(client_cache);
@@ -4699,6 +4742,7 @@ impl __sdk::SpacetimeModule for RemoteModule {
"profile_membership",
"profile_played_world",
"profile_recharge_order",
"profile_recharge_product_config",
"profile_redeem_code",
"profile_redeem_code_usage",
"profile_referral_relation",

View File

@@ -0,0 +1,171 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use super::profile_recharge_product_config_type::ProfileRechargeProductConfig;
use super::runtime_profile_membership_tier_type::RuntimeProfileMembershipTier;
use super::runtime_profile_recharge_product_kind_type::RuntimeProfileRechargeProductKind;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `profile_recharge_product_config`.
///
/// Obtain a handle from the [`ProfileRechargeProductConfigTableAccess::profile_recharge_product_config`] method on [`super::RemoteTables`],
/// like `ctx.db.profile_recharge_product_config()`.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.profile_recharge_product_config().on_insert(...)`.
pub struct ProfileRechargeProductConfigTableHandle<'ctx> {
imp: __sdk::TableHandle<ProfileRechargeProductConfig>,
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the table `profile_recharge_product_config`.
///
/// Implemented for [`super::RemoteTables`].
pub trait ProfileRechargeProductConfigTableAccess {
#[allow(non_snake_case)]
/// Obtain a [`ProfileRechargeProductConfigTableHandle`], which mediates access to the table `profile_recharge_product_config`.
fn profile_recharge_product_config(&self) -> ProfileRechargeProductConfigTableHandle<'_>;
}
impl ProfileRechargeProductConfigTableAccess for super::RemoteTables {
fn profile_recharge_product_config(&self) -> ProfileRechargeProductConfigTableHandle<'_> {
ProfileRechargeProductConfigTableHandle {
imp: self
.imp
.get_table::<ProfileRechargeProductConfig>("profile_recharge_product_config"),
ctx: std::marker::PhantomData,
}
}
}
pub struct ProfileRechargeProductConfigInsertCallbackId(__sdk::CallbackId);
pub struct ProfileRechargeProductConfigDeleteCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::Table for ProfileRechargeProductConfigTableHandle<'ctx> {
type Row = ProfileRechargeProductConfig;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = ProfileRechargeProductConfig> + '_ {
self.imp.iter()
}
type InsertCallbackId = ProfileRechargeProductConfigInsertCallbackId;
fn on_insert(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> ProfileRechargeProductConfigInsertCallbackId {
ProfileRechargeProductConfigInsertCallbackId(self.imp.on_insert(Box::new(callback)))
}
fn remove_on_insert(&self, callback: ProfileRechargeProductConfigInsertCallbackId) {
self.imp.remove_on_insert(callback.0)
}
type DeleteCallbackId = ProfileRechargeProductConfigDeleteCallbackId;
fn on_delete(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> ProfileRechargeProductConfigDeleteCallbackId {
ProfileRechargeProductConfigDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
}
fn remove_on_delete(&self, callback: ProfileRechargeProductConfigDeleteCallbackId) {
self.imp.remove_on_delete(callback.0)
}
}
pub struct ProfileRechargeProductConfigUpdateCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::TableWithPrimaryKey for ProfileRechargeProductConfigTableHandle<'ctx> {
type UpdateCallbackId = ProfileRechargeProductConfigUpdateCallbackId;
fn on_update(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
) -> ProfileRechargeProductConfigUpdateCallbackId {
ProfileRechargeProductConfigUpdateCallbackId(self.imp.on_update(Box::new(callback)))
}
fn remove_on_update(&self, callback: ProfileRechargeProductConfigUpdateCallbackId) {
self.imp.remove_on_update(callback.0)
}
}
/// Access to the `product_id` unique index on the table `profile_recharge_product_config`,
/// which allows point queries on the field of the same name
/// via the [`ProfileRechargeProductConfigProductIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.profile_recharge_product_config().product_id().find(...)`.
pub struct ProfileRechargeProductConfigProductIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<ProfileRechargeProductConfig, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> ProfileRechargeProductConfigTableHandle<'ctx> {
/// Get a handle on the `product_id` unique index on the table `profile_recharge_product_config`.
pub fn product_id(&self) -> ProfileRechargeProductConfigProductIdUnique<'ctx> {
ProfileRechargeProductConfigProductIdUnique {
imp: self.imp.get_unique_constraint::<String>("product_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> ProfileRechargeProductConfigProductIdUnique<'ctx> {
/// Find the subscribed row whose `product_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<ProfileRechargeProductConfig> {
self.imp.find(col_val)
}
}
#[doc(hidden)]
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
let _table = client_cache
.get_or_make_table::<ProfileRechargeProductConfig>("profile_recharge_product_config");
_table.add_unique_constraint::<String>("product_id", |row| &row.product_id);
}
#[doc(hidden)]
pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<ProfileRechargeProductConfig>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse(
"TableUpdate<ProfileRechargeProductConfig>",
"TableUpdate",
)
.with_cause(e)
.into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `ProfileRechargeProductConfig`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait profile_recharge_product_configQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `ProfileRechargeProductConfig`.
fn profile_recharge_product_config(
&self,
) -> __sdk::__query_builder::Table<ProfileRechargeProductConfig>;
}
impl profile_recharge_product_configQueryTableAccess for __sdk::QueryTableAccessor {
fn profile_recharge_product_config(
&self,
) -> __sdk::__query_builder::Table<ProfileRechargeProductConfig> {
__sdk::__query_builder::Table::new("profile_recharge_product_config")
}
}

View File

@@ -0,0 +1,101 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::runtime_profile_membership_tier_type::RuntimeProfileMembershipTier;
use super::runtime_profile_recharge_product_kind_type::RuntimeProfileRechargeProductKind;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct ProfileRechargeProductConfig {
pub product_id: String,
pub title: String,
pub price_cents: u64,
pub kind: RuntimeProfileRechargeProductKind,
pub points_amount: u64,
pub bonus_points: u64,
pub duration_days: u32,
pub badge_label: String,
pub description: String,
pub tier: RuntimeProfileMembershipTier,
pub enabled: bool,
pub sort_order: i32,
pub created_by: String,
pub created_at: __sdk::Timestamp,
pub updated_by: String,
pub updated_at: __sdk::Timestamp,
}
impl __sdk::InModule for ProfileRechargeProductConfig {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `ProfileRechargeProductConfig`.
///
/// Provides typed access to columns for query building.
pub struct ProfileRechargeProductConfigCols {
pub product_id: __sdk::__query_builder::Col<ProfileRechargeProductConfig, String>,
pub title: __sdk::__query_builder::Col<ProfileRechargeProductConfig, String>,
pub price_cents: __sdk::__query_builder::Col<ProfileRechargeProductConfig, u64>,
pub kind: __sdk::__query_builder::Col<
ProfileRechargeProductConfig,
RuntimeProfileRechargeProductKind,
>,
pub points_amount: __sdk::__query_builder::Col<ProfileRechargeProductConfig, u64>,
pub bonus_points: __sdk::__query_builder::Col<ProfileRechargeProductConfig, u64>,
pub duration_days: __sdk::__query_builder::Col<ProfileRechargeProductConfig, u32>,
pub badge_label: __sdk::__query_builder::Col<ProfileRechargeProductConfig, String>,
pub description: __sdk::__query_builder::Col<ProfileRechargeProductConfig, String>,
pub tier:
__sdk::__query_builder::Col<ProfileRechargeProductConfig, RuntimeProfileMembershipTier>,
pub enabled: __sdk::__query_builder::Col<ProfileRechargeProductConfig, bool>,
pub sort_order: __sdk::__query_builder::Col<ProfileRechargeProductConfig, i32>,
pub created_by: __sdk::__query_builder::Col<ProfileRechargeProductConfig, String>,
pub created_at: __sdk::__query_builder::Col<ProfileRechargeProductConfig, __sdk::Timestamp>,
pub updated_by: __sdk::__query_builder::Col<ProfileRechargeProductConfig, String>,
pub updated_at: __sdk::__query_builder::Col<ProfileRechargeProductConfig, __sdk::Timestamp>,
}
impl __sdk::__query_builder::HasCols for ProfileRechargeProductConfig {
type Cols = ProfileRechargeProductConfigCols;
fn cols(table_name: &'static str) -> Self::Cols {
ProfileRechargeProductConfigCols {
product_id: __sdk::__query_builder::Col::new(table_name, "product_id"),
title: __sdk::__query_builder::Col::new(table_name, "title"),
price_cents: __sdk::__query_builder::Col::new(table_name, "price_cents"),
kind: __sdk::__query_builder::Col::new(table_name, "kind"),
points_amount: __sdk::__query_builder::Col::new(table_name, "points_amount"),
bonus_points: __sdk::__query_builder::Col::new(table_name, "bonus_points"),
duration_days: __sdk::__query_builder::Col::new(table_name, "duration_days"),
badge_label: __sdk::__query_builder::Col::new(table_name, "badge_label"),
description: __sdk::__query_builder::Col::new(table_name, "description"),
tier: __sdk::__query_builder::Col::new(table_name, "tier"),
enabled: __sdk::__query_builder::Col::new(table_name, "enabled"),
sort_order: __sdk::__query_builder::Col::new(table_name, "sort_order"),
created_by: __sdk::__query_builder::Col::new(table_name, "created_by"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
updated_by: __sdk::__query_builder::Col::new(table_name, "updated_by"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}
}
}
/// Indexed column accessor struct for the table `ProfileRechargeProductConfig`.
///
/// Provides typed access to indexed columns for query building.
pub struct ProfileRechargeProductConfigIxCols {
pub product_id: __sdk::__query_builder::IxCol<ProfileRechargeProductConfig, String>,
}
impl __sdk::__query_builder::HasIxCols for ProfileRechargeProductConfig {
type IxCols = ProfileRechargeProductConfigIxCols;
fn ix_cols(table_name: &'static str) -> Self::IxCols {
ProfileRechargeProductConfigIxCols {
product_id: __sdk::__query_builder::IxCol::new(table_name, "product_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for ProfileRechargeProductConfig {}

View File

@@ -0,0 +1,15 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct RuntimeProfileRechargeProductAdminListInput {
pub admin_user_id: String,
}
impl __sdk::InModule for RuntimeProfileRechargeProductAdminListInput {
type Module = super::RemoteModule;
}

View File

@@ -0,0 +1,19 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::runtime_profile_recharge_product_config_snapshot_type::RuntimeProfileRechargeProductConfigSnapshot;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct RuntimeProfileRechargeProductAdminListProcedureResult {
pub ok: bool,
pub entries: Vec<RuntimeProfileRechargeProductConfigSnapshot>,
pub error_message: Option<String>,
}
impl __sdk::InModule for RuntimeProfileRechargeProductAdminListProcedureResult {
type Module = super::RemoteModule;
}

View File

@@ -0,0 +1,19 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::runtime_profile_recharge_product_config_snapshot_type::RuntimeProfileRechargeProductConfigSnapshot;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct RuntimeProfileRechargeProductAdminProcedureResult {
pub ok: bool,
pub record: Option<RuntimeProfileRechargeProductConfigSnapshot>,
pub error_message: Option<String>,
}
impl __sdk::InModule for RuntimeProfileRechargeProductAdminProcedureResult {
type Module = super::RemoteModule;
}

View File

@@ -0,0 +1,31 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::runtime_profile_membership_tier_type::RuntimeProfileMembershipTier;
use super::runtime_profile_recharge_product_kind_type::RuntimeProfileRechargeProductKind;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct RuntimeProfileRechargeProductAdminUpsertInput {
pub admin_user_id: String,
pub product_id: String,
pub title: String,
pub price_cents: u64,
pub kind: RuntimeProfileRechargeProductKind,
pub points_amount: u64,
pub bonus_points: u64,
pub duration_days: u32,
pub badge_label: String,
pub description: String,
pub tier: RuntimeProfileMembershipTier,
pub enabled: bool,
pub sort_order: i32,
pub updated_at_micros: i64,
}
impl __sdk::InModule for RuntimeProfileRechargeProductAdminUpsertInput {
type Module = super::RemoteModule;
}

View File

@@ -0,0 +1,33 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::runtime_profile_membership_tier_type::RuntimeProfileMembershipTier;
use super::runtime_profile_recharge_product_kind_type::RuntimeProfileRechargeProductKind;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct RuntimeProfileRechargeProductConfigSnapshot {
pub product_id: String,
pub title: String,
pub price_cents: u64,
pub kind: RuntimeProfileRechargeProductKind,
pub points_amount: u64,
pub bonus_points: u64,
pub duration_days: u32,
pub badge_label: String,
pub description: String,
pub tier: RuntimeProfileMembershipTier,
pub enabled: bool,
pub sort_order: i32,
pub created_by: String,
pub created_at_micros: i64,
pub updated_by: String,
pub updated_at_micros: i64,
}
impl __sdk::InModule for RuntimeProfileRechargeProductConfigSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -657,6 +657,78 @@ impl SpacetimeClient {
.await
}
pub async fn admin_list_profile_recharge_products(
&self,
admin_user_id: String,
) -> Result<Vec<RuntimeProfileRechargeProductConfigRecord>, SpacetimeClientError> {
let procedure_input =
build_runtime_profile_recharge_product_admin_list_input(admin_user_id)
.map_err(SpacetimeClientError::validation_failed)?
.into();
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.admin_list_profile_recharge_products_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_runtime_profile_recharge_product_admin_list_procedure_result);
send_once(&sender, mapped);
});
})
.await
}
#[allow(clippy::too_many_arguments)]
pub async fn admin_upsert_profile_recharge_product(
&self,
admin_user_id: String,
product_id: String,
title: String,
price_cents: u64,
kind: module_runtime::RuntimeProfileRechargeProductKind,
points_amount: u64,
bonus_points: u64,
duration_days: u32,
badge_label: String,
description: String,
tier: module_runtime::RuntimeProfileMembershipTier,
enabled: bool,
sort_order: i32,
updated_at_micros: i64,
) -> Result<RuntimeProfileRechargeProductConfigRecord, SpacetimeClientError> {
let procedure_input = build_runtime_profile_recharge_product_admin_upsert_input(
admin_user_id,
product_id,
title,
price_cents,
kind,
points_amount,
bonus_points,
duration_days,
badge_label,
description,
tier,
enabled,
sort_order,
updated_at_micros,
)
.map_err(SpacetimeClientError::validation_failed)?
.into();
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.admin_upsert_profile_recharge_product_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_runtime_profile_recharge_product_admin_procedure_result);
send_once(&sender, mapped);
});
})
.await
}
pub async fn admin_upsert_profile_redeem_code(
&self,
admin_user_id: String,