重构(会员): 会员目录与自然月账期落到数据库与领域层

- 领域层新增会员档位枚举、自然月账期、目录快照与补差报价入参,删除旧 tier 相关函数
- profile_membership 表以 plan 与自然月期数取代 tier 与固定 30 天周期
- profile_recharge_order 末位追加会员权益变更快照,供人工复核退款
- profile_membership_plan 目录表成为价格与权益的唯一真相源,新增后台读写接口
- 充点商品收敛为六档且取消首充赠送,旧播种行按新规则迁移
- 充值中心改为输出会员目录,不再输出会员商品行与权益矩阵
- 重新生成 SpacetimeDB 绑定并同步客户端映射与 facade

Co-authored-by: Junie <junie@jetbrains.com>
This commit is contained in:
2026-10-02 16:59:34 +08:00
parent 03073564b1
commit e98564e13c
39 changed files with 1176 additions and 482 deletions
@@ -436,6 +436,69 @@ pub fn build_runtime_profile_recharge_product_admin_upsert_input(
})
}
pub fn build_runtime_profile_membership_plan_admin_list_input(
admin_user_id: String,
) -> Result<RuntimeProfileMembershipPlanAdminListInput, RuntimeProfileFieldError> {
let admin_user_id = normalize_runtime_profile_user_id(admin_user_id)?;
Ok(RuntimeProfileMembershipPlanAdminListInput { admin_user_id })
}
/// 后台会员档位改价 / 改权益入参校验。
///
/// `normal` 是不可购买的非会员占位档位:它的价格与额度没有意义,一律按 0 落库。
#[allow(clippy::too_many_arguments)]
pub fn build_runtime_profile_membership_plan_admin_upsert_input(
admin_user_id: String,
plan: RuntimeProfileMembershipPlan,
title: String,
month_price_cents: u64,
year_price_cents: u64,
period_points: u64,
model_access: RuntimeProfileMembershipModelAccess,
concurrent_job_limit: u32,
enabled: bool,
sort_order: i32,
updated_at_micros: i64,
) -> Result<RuntimeProfileMembershipPlanAdminUpsertInput, RuntimeProfileFieldError> {
let admin_user_id = normalize_runtime_profile_user_id(admin_user_id)?;
let title =
normalize_required_string(title).ok_or(RuntimeProfileFieldError::MissingProductTitle)?;
if !plan.is_purchasable() {
return Ok(RuntimeProfileMembershipPlanAdminUpsertInput {
admin_user_id,
plan,
title,
month_price_cents: 0,
year_price_cents: 0,
period_points: 0,
model_access,
concurrent_job_limit,
enabled: false,
sort_order,
updated_at_micros,
});
}
if month_price_cents == 0 || year_price_cents == 0 || concurrent_job_limit == 0 {
return Err(RuntimeProfileFieldError::InvalidMembershipPlan);
}
Ok(RuntimeProfileMembershipPlanAdminUpsertInput {
admin_user_id,
plan,
title,
month_price_cents,
year_price_cents,
period_points,
model_access,
concurrent_job_limit,
enabled,
sort_order,
updated_at_micros,
})
}
pub fn build_runtime_profile_recharge_order_paid_input(
order_id: String,
paid_at_micros: i64,
@@ -1698,6 +1698,30 @@ pub struct RuntimeProfileRechargeOrderAdminEntrySnapshot {
pub refunds: Vec<RuntimeProfileRechargeRefundSnapshot>,
pub active_hold: Option<RuntimeProfileRechargeRefundHoldSnapshot>,
pub wallet: RuntimeProfileAdminWalletSnapshot,
/// 会员购买 / 升级的权益变更快照;人工复核退款时据此还原变更前后的档位、周期、补点与有效期。
pub membership_change: Option<RuntimeProfileMembershipOrderChangeSnapshot>,
}
/// 会员订单的权益变更快照(只读投影,字段与 `profile_recharge_order` 的末位快照列一一对应)。
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileMembershipOrderChangeSnapshot {
/// `purchase` 或 `upgrade`。
pub change_kind: String,
pub plan_before: Option<String>,
pub plan_after: Option<String>,
pub cycle_kind_before: Option<String>,
pub cycle_kind_after: Option<String>,
pub period_points_before: Option<u64>,
pub period_points_after: Option<u64>,
pub granted_points_delta: i64,
pub cycle_index: Option<u32>,
pub expires_at_before_micros: Option<i64>,
pub expires_at_after_micros: Option<i64>,
pub cycle_resets_at_before_micros: Option<i64>,
pub cycle_resets_at_after_micros: Option<i64>,
/// 订单价格拆分 JSON(目标档位价、当前档位价、实付金额),仅用于人工核对。
pub price_breakdown_json: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
@@ -1780,6 +1804,48 @@ pub struct RuntimeProfileRechargeProductAdminProcedureResult {
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileMembershipPlanAdminListInput {
pub admin_user_id: String,
}
/// 后台会员档位改价 / 改权益入参。
///
/// `rank` 不在入参里:升级比较基准由代码内的档位目录决定,后台不能改。
/// `title` 与 `sort_order` 仍可编辑,`normal` 档位的价格与额度会被忽略(它不可购买)。
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileMembershipPlanAdminUpsertInput {
pub admin_user_id: String,
pub plan: RuntimeProfileMembershipPlan,
pub title: String,
pub month_price_cents: u64,
pub year_price_cents: u64,
pub period_points: u64,
pub model_access: RuntimeProfileMembershipModelAccess,
pub concurrent_job_limit: u32,
pub enabled: bool,
pub sort_order: i32,
pub updated_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileMembershipPlanAdminListProcedureResult {
pub ok: bool,
pub entries: Vec<RuntimeProfileMembershipPlanRecord>,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileMembershipPlanAdminProcedureResult {
pub ok: bool,
pub record: Option<RuntimeProfileMembershipPlanRecord>,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileRechargeCenterGetInput {
@@ -91,6 +91,7 @@ pub enum RuntimeProfileFieldError {
InvalidRechargeProductDuration,
InvalidRechargeProductKind,
InvalidRechargeProductTier,
InvalidMembershipPlan,
MissingPaymentChannel,
#[cfg(any())]
MissingWorldKey,
@@ -186,6 +187,9 @@ impl std::fmt::Display for RuntimeProfileFieldError {
}
Self::InvalidRechargeProductKind => f.write_str("充值商品类型无效"),
Self::InvalidRechargeProductTier => f.write_str("会员商品 tier 无效"),
Self::InvalidMembershipPlan => {
f.write_str("会员档位配置无效:月价、年价、每期泥点与并发上限必须有效")
}
Self::MissingPaymentChannel => f.write_str("recharge.payment_channel 不能为空"),
#[cfg(any())]
Self::MissingWorldKey => f.write_str("profile.world_key 不能为空"),
@@ -87,6 +87,8 @@ use module_runtime::{
build_runtime_profile_feedback_submission_record,
build_runtime_profile_invite_code_admin_list_input,
build_runtime_profile_invite_code_admin_upsert_input, build_runtime_profile_invite_code_record,
build_runtime_profile_membership_plan_admin_list_input,
build_runtime_profile_membership_plan_admin_upsert_input,
build_runtime_profile_recharge_center_get_input, build_runtime_profile_recharge_center_record,
build_runtime_profile_recharge_order_close_input,
build_runtime_profile_recharge_order_create_input,
@@ -563,11 +563,6 @@ impl From<module_runtime::RuntimeProfileRechargeProductAdminUpsertInput>
duration_days: input.duration_days,
badge_label: input.badge_label,
description: input.description,
tier: map_runtime_profile_membership_tier(input.tier),
membership_period_points: input.membership_period_points,
membership_period_days: input.membership_period_days,
membership_queue_limit: input.membership_queue_limit,
membership_discount_bps: input.membership_discount_bps,
enabled: input.enabled,
sort_order: input.sort_order,
updated_at_micros: input.updated_at_micros,
@@ -1381,11 +1376,6 @@ pub(crate) fn map_runtime_profile_recharge_product_snapshot(
duration_days: snapshot.duration_days,
badge_label: snapshot.badge_label,
description: snapshot.description,
tier: map_runtime_profile_membership_tier_back(snapshot.tier),
membership_period_points: snapshot.membership_period_points,
membership_period_days: snapshot.membership_period_days,
membership_queue_limit: snapshot.membership_queue_limit,
membership_discount_bps: snapshot.membership_discount_bps,
}
}
@@ -1401,15 +1391,10 @@ pub(crate) fn map_runtime_profile_recharge_center_snapshot(
.into_iter()
.map(map_runtime_profile_recharge_product_snapshot)
.collect(),
membership_products: snapshot
.membership_products
membership_plans: snapshot
.membership_plans
.into_iter()
.map(map_runtime_profile_recharge_product_snapshot)
.collect(),
benefits: snapshot
.benefits
.into_iter()
.map(map_runtime_profile_membership_benefit_snapshot)
.map(map_runtime_profile_membership_plan_record)
.collect(),
latest_order: snapshot
.latest_order
@@ -1434,11 +1419,6 @@ pub(crate) fn map_runtime_profile_recharge_product_config_snapshot(
duration_days: snapshot.duration_days,
badge_label: snapshot.badge_label,
description: snapshot.description,
tier: map_runtime_profile_membership_tier_back(snapshot.tier),
membership_period_points: snapshot.membership_period_points,
membership_period_days: snapshot.membership_period_days,
membership_queue_limit: snapshot.membership_queue_limit,
membership_discount_bps: snapshot.membership_discount_bps,
enabled: snapshot.enabled,
sort_order: snapshot.sort_order,
created_by: snapshot.created_by,
@@ -1448,19 +1428,20 @@ pub(crate) fn map_runtime_profile_recharge_product_config_snapshot(
}
}
pub(crate) fn map_runtime_profile_membership_benefit_snapshot(
snapshot: RuntimeProfileMembershipBenefitSnapshot,
) -> module_runtime::RuntimeProfileMembershipBenefitSnapshot {
module_runtime::RuntimeProfileMembershipBenefitSnapshot {
benefit_name: snapshot.benefit_name,
normal_value: snapshot.normal_value,
month_value: snapshot.month_value,
season_value: snapshot.season_value,
year_value: snapshot.year_value,
starter_value: snapshot.starter_value,
basic_value: snapshot.basic_value,
pro_value: snapshot.pro_value,
ultimate_value: snapshot.ultimate_value,
pub(crate) fn map_runtime_profile_membership_plan_record(
record: RuntimeProfileMembershipPlanRecord,
) -> module_runtime::RuntimeProfileMembershipPlanRecord {
module_runtime::RuntimeProfileMembershipPlanRecord {
plan: map_runtime_profile_membership_plan_back(record.plan),
title: record.title,
rank: record.rank,
month_price_cents: record.month_price_cents,
year_price_cents: record.year_price_cents,
period_points: record.period_points,
model_access: map_runtime_profile_membership_model_access_back(record.model_access),
concurrent_job_limit: record.concurrent_job_limit,
sort_order: record.sort_order,
enabled: record.enabled,
}
}
@@ -1470,7 +1451,7 @@ pub(crate) fn map_runtime_profile_membership_snapshot(
module_runtime::RuntimeProfileMembershipSnapshot {
user_id: snapshot.user_id,
status: map_runtime_profile_membership_status_back(snapshot.status),
tier: map_runtime_profile_membership_tier_back(snapshot.tier),
plan: map_runtime_profile_membership_plan_back(snapshot.plan),
started_at_micros: snapshot.started_at_micros,
expires_at_micros: snapshot.expires_at_micros,
updated_at_micros: snapshot.updated_at_micros,
@@ -1478,7 +1459,9 @@ pub(crate) fn map_runtime_profile_membership_snapshot(
cycle_resets_at_micros: snapshot.cycle_resets_at_micros,
cycle_granted_points: snapshot.cycle_granted_points,
cycle_remaining_points: snapshot.cycle_remaining_points,
cycle_period_days: snapshot.cycle_period_days,
cycle_index: snapshot.cycle_index,
cycle_count: snapshot.cycle_count,
cycle_kind: map_runtime_profile_membership_cycle_kind_back(snapshot.cycle_kind),
}
}
@@ -1635,6 +1618,9 @@ pub(crate) fn map_runtime_profile_recharge_order_admin_entry_snapshot(
.active_hold
.map(map_runtime_profile_recharge_refund_hold_snapshot),
wallet: map_runtime_profile_admin_wallet_snapshot(snapshot.wallet),
membership_change: snapshot
.membership_change
.map(map_runtime_profile_membership_order_change_snapshot),
}
}
@@ -1956,37 +1942,168 @@ 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 {
pub(crate) fn map_runtime_profile_membership_plan(
value: module_runtime::RuntimeProfileMembershipPlan,
) -> crate::module_bindings::RuntimeProfileMembershipPlan {
match value {
module_runtime::RuntimeProfileMembershipTier::Normal => {
crate::module_bindings::RuntimeProfileMembershipTier::Normal
module_runtime::RuntimeProfileMembershipPlan::Normal => {
crate::module_bindings::RuntimeProfileMembershipPlan::Normal
}
module_runtime::RuntimeProfileMembershipTier::Month => {
crate::module_bindings::RuntimeProfileMembershipTier::Month
module_runtime::RuntimeProfileMembershipPlan::Starter => {
crate::module_bindings::RuntimeProfileMembershipPlan::Starter
}
module_runtime::RuntimeProfileMembershipTier::Season => {
crate::module_bindings::RuntimeProfileMembershipTier::Season
module_runtime::RuntimeProfileMembershipPlan::Plus => {
crate::module_bindings::RuntimeProfileMembershipPlan::Plus
}
module_runtime::RuntimeProfileMembershipTier::Year => {
crate::module_bindings::RuntimeProfileMembershipTier::Year
module_runtime::RuntimeProfileMembershipPlan::Pro => {
crate::module_bindings::RuntimeProfileMembershipPlan::Pro
}
module_runtime::RuntimeProfileMembershipTier::Starter => {
crate::module_bindings::RuntimeProfileMembershipTier::Starter
}
module_runtime::RuntimeProfileMembershipTier::Basic => {
crate::module_bindings::RuntimeProfileMembershipTier::Basic
}
module_runtime::RuntimeProfileMembershipTier::Pro => {
crate::module_bindings::RuntimeProfileMembershipTier::Pro
}
module_runtime::RuntimeProfileMembershipTier::Ultimate => {
crate::module_bindings::RuntimeProfileMembershipTier::Ultimate
module_runtime::RuntimeProfileMembershipPlan::Max => {
crate::module_bindings::RuntimeProfileMembershipPlan::Max
}
}
}
pub(crate) fn map_runtime_profile_membership_plan_back(
value: crate::module_bindings::RuntimeProfileMembershipPlan,
) -> module_runtime::RuntimeProfileMembershipPlan {
match value {
crate::module_bindings::RuntimeProfileMembershipPlan::Normal => {
module_runtime::RuntimeProfileMembershipPlan::Normal
}
crate::module_bindings::RuntimeProfileMembershipPlan::Starter => {
module_runtime::RuntimeProfileMembershipPlan::Starter
}
crate::module_bindings::RuntimeProfileMembershipPlan::Plus => {
module_runtime::RuntimeProfileMembershipPlan::Plus
}
crate::module_bindings::RuntimeProfileMembershipPlan::Pro => {
module_runtime::RuntimeProfileMembershipPlan::Pro
}
crate::module_bindings::RuntimeProfileMembershipPlan::Max => {
module_runtime::RuntimeProfileMembershipPlan::Max
}
}
}
pub(crate) fn map_runtime_profile_membership_cycle_kind_back(
value: crate::module_bindings::RuntimeProfileMembershipCycleKind,
) -> module_runtime::RuntimeProfileMembershipCycleKind {
match value {
crate::module_bindings::RuntimeProfileMembershipCycleKind::Monthly => {
module_runtime::RuntimeProfileMembershipCycleKind::Monthly
}
crate::module_bindings::RuntimeProfileMembershipCycleKind::Yearly => {
module_runtime::RuntimeProfileMembershipCycleKind::Yearly
}
}
}
pub(crate) fn map_runtime_profile_membership_model_access(
value: module_runtime::RuntimeProfileMembershipModelAccess,
) -> crate::module_bindings::RuntimeProfileMembershipModelAccess {
match value {
module_runtime::RuntimeProfileMembershipModelAccess::Basic => {
crate::module_bindings::RuntimeProfileMembershipModelAccess::Basic
}
module_runtime::RuntimeProfileMembershipModelAccess::Full => {
crate::module_bindings::RuntimeProfileMembershipModelAccess::Full
}
}
}
pub(crate) fn map_runtime_profile_membership_model_access_back(
value: crate::module_bindings::RuntimeProfileMembershipModelAccess,
) -> module_runtime::RuntimeProfileMembershipModelAccess {
match value {
crate::module_bindings::RuntimeProfileMembershipModelAccess::Basic => {
module_runtime::RuntimeProfileMembershipModelAccess::Basic
}
crate::module_bindings::RuntimeProfileMembershipModelAccess::Full => {
module_runtime::RuntimeProfileMembershipModelAccess::Full
}
}
}
pub(crate) fn map_runtime_profile_membership_order_change_snapshot(
snapshot: RuntimeProfileMembershipOrderChangeSnapshot,
) -> module_runtime::RuntimeProfileMembershipOrderChangeSnapshot {
module_runtime::RuntimeProfileMembershipOrderChangeSnapshot {
change_kind: snapshot.change_kind,
plan_before: snapshot.plan_before,
plan_after: snapshot.plan_after,
cycle_kind_before: snapshot.cycle_kind_before,
cycle_kind_after: snapshot.cycle_kind_after,
period_points_before: snapshot.period_points_before,
period_points_after: snapshot.period_points_after,
granted_points_delta: snapshot.granted_points_delta,
cycle_index: snapshot.cycle_index,
expires_at_before_micros: snapshot.expires_at_before_micros,
expires_at_after_micros: snapshot.expires_at_after_micros,
cycle_resets_at_before_micros: snapshot.cycle_resets_at_before_micros,
cycle_resets_at_after_micros: snapshot.cycle_resets_at_after_micros,
price_breakdown_json: snapshot.price_breakdown_json,
}
}
impl From<module_runtime::RuntimeProfileMembershipPlanAdminListInput>
for RuntimeProfileMembershipPlanAdminListInput
{
fn from(input: module_runtime::RuntimeProfileMembershipPlanAdminListInput) -> Self {
Self {
admin_user_id: input.admin_user_id,
}
}
}
impl From<module_runtime::RuntimeProfileMembershipPlanAdminUpsertInput>
for RuntimeProfileMembershipPlanAdminUpsertInput
{
fn from(input: module_runtime::RuntimeProfileMembershipPlanAdminUpsertInput) -> Self {
Self {
admin_user_id: input.admin_user_id,
plan: map_runtime_profile_membership_plan(input.plan),
title: input.title,
month_price_cents: input.month_price_cents,
year_price_cents: input.year_price_cents,
period_points: input.period_points,
model_access: map_runtime_profile_membership_model_access(input.model_access),
concurrent_job_limit: input.concurrent_job_limit,
enabled: input.enabled,
sort_order: input.sort_order,
updated_at_micros: input.updated_at_micros,
}
}
}
pub(crate) fn map_runtime_profile_membership_plan_admin_list_procedure_result(
result: RuntimeProfileMembershipPlanAdminListProcedureResult,
) -> Result<Vec<module_runtime::RuntimeProfileMembershipPlanRecord>, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
Ok(result
.entries
.into_iter()
.map(map_runtime_profile_membership_plan_record)
.collect())
}
pub(crate) fn map_runtime_profile_membership_plan_admin_procedure_result(
result: RuntimeProfileMembershipPlanAdminProcedureResult,
) -> Result<module_runtime::RuntimeProfileMembershipPlanRecord, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
let record = result
.record
.ok_or_else(|| SpacetimeClientError::missing_snapshot("membership plan 快照"))?;
Ok(map_runtime_profile_membership_plan_record(record))
}
pub(crate) fn map_runtime_profile_membership_status_back(
value: crate::module_bindings::RuntimeProfileMembershipStatus,
) -> module_runtime::RuntimeProfileMembershipStatus {
@@ -2000,37 +2117,6 @@ pub(crate) fn map_runtime_profile_membership_status_back(
}
}
pub(crate) fn map_runtime_profile_membership_tier_back(
value: crate::module_bindings::RuntimeProfileMembershipTier,
) -> module_runtime::RuntimeProfileMembershipTier {
match value {
crate::module_bindings::RuntimeProfileMembershipTier::Normal => {
module_runtime::RuntimeProfileMembershipTier::Normal
}
crate::module_bindings::RuntimeProfileMembershipTier::Month => {
module_runtime::RuntimeProfileMembershipTier::Month
}
crate::module_bindings::RuntimeProfileMembershipTier::Season => {
module_runtime::RuntimeProfileMembershipTier::Season
}
crate::module_bindings::RuntimeProfileMembershipTier::Year => {
module_runtime::RuntimeProfileMembershipTier::Year
}
crate::module_bindings::RuntimeProfileMembershipTier::Starter => {
module_runtime::RuntimeProfileMembershipTier::Starter
}
crate::module_bindings::RuntimeProfileMembershipTier::Basic => {
module_runtime::RuntimeProfileMembershipTier::Basic
}
crate::module_bindings::RuntimeProfileMembershipTier::Pro => {
module_runtime::RuntimeProfileMembershipTier::Pro
}
crate::module_bindings::RuntimeProfileMembershipTier::Ultimate => {
module_runtime::RuntimeProfileMembershipTier::Ultimate
}
}
}
pub(crate) fn map_runtime_profile_recharge_order_status_back(
value: crate::module_bindings::RuntimeProfileRechargeOrderStatus,
) -> module_runtime::RuntimeProfileRechargeOrderStatus {
@@ -1652,11 +1652,6 @@ impl SpacetimeClient {
duration_days: u32,
badge_label: String,
description: String,
tier: module_runtime::RuntimeProfileMembershipTier,
membership_period_points: u64,
membership_period_days: u32,
membership_queue_limit: u32,
membership_discount_bps: u32,
enabled: bool,
sort_order: i32,
updated_at_micros: i64,
@@ -1672,11 +1667,6 @@ impl SpacetimeClient {
duration_days,
badge_label,
description,
tier,
membership_period_points,
membership_period_days,
membership_queue_limit,
membership_discount_bps,
enabled,
sort_order,
updated_at_micros,
@@ -1705,6 +1695,86 @@ impl SpacetimeClient {
.await
}
/// 后台读取会员档位目录(价格与权益的唯一真相源)。
pub async fn admin_list_profile_membership_plans(
&self,
admin_user_id: String,
) -> Result<Vec<module_runtime::RuntimeProfileMembershipPlanRecord>, SpacetimeClientError> {
let procedure_input = build_runtime_profile_membership_plan_admin_list_input(admin_user_id)
.map_err(SpacetimeClientError::validation_failed)?
.into();
self.call_after_connect(
"admin_list_profile_membership_plans",
move |connection, sender| {
connection
.procedures()
.admin_list_profile_membership_plans_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(
map_runtime_profile_membership_plan_admin_list_procedure_result,
);
send_once(&sender, mapped);
});
},
)
.await
}
/// 后台按档位改会员价格与权益;`rank` 由代码内目录决定,后台不能改。
#[allow(clippy::too_many_arguments)]
pub async fn admin_upsert_profile_membership_plan(
&self,
admin_user_id: String,
plan: module_runtime::RuntimeProfileMembershipPlan,
title: String,
month_price_cents: u64,
year_price_cents: u64,
period_points: u64,
model_access: module_runtime::RuntimeProfileMembershipModelAccess,
concurrent_job_limit: u32,
enabled: bool,
sort_order: i32,
updated_at_micros: i64,
) -> Result<module_runtime::RuntimeProfileMembershipPlanRecord, SpacetimeClientError> {
let procedure_input = build_runtime_profile_membership_plan_admin_upsert_input(
admin_user_id,
plan,
title,
month_price_cents,
year_price_cents,
period_points,
model_access,
concurrent_job_limit,
enabled,
sort_order,
updated_at_micros,
)
.map_err(SpacetimeClientError::validation_failed)?
.into();
self.call_after_connect(
"admin_upsert_profile_membership_plan",
move |connection, sender| {
connection
.procedures()
.admin_upsert_profile_membership_plan_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(
map_runtime_profile_membership_plan_admin_procedure_result,
);
send_once(&sender, mapped);
},
);
},
)
.await
}
pub async fn admin_upsert_profile_redeem_code(
&self,
admin_user_id: String,
@@ -38,6 +38,7 @@ pub mod admin_initialize_profile_wallet_consumption_projections_and_return_proce
pub mod admin_list_editor_assets_and_return_procedure;
pub mod admin_list_editor_showcase_assets_and_return_procedure;
pub mod admin_list_profile_invite_codes_procedure;
pub mod admin_list_profile_membership_plans_procedure;
pub mod admin_list_profile_recharge_orders_and_return_procedure;
pub mod admin_list_profile_recharge_products_procedure;
pub mod admin_list_profile_redeem_codes_procedure;
@@ -45,6 +46,7 @@ pub mod admin_list_profile_task_configs_procedure;
pub mod admin_reconcile_profile_wallet_consumption_and_return_procedure;
pub mod admin_review_editor_showcase_asset_and_return_procedure;
pub mod admin_upsert_profile_invite_code_procedure;
pub mod admin_upsert_profile_membership_plan_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;
@@ -648,12 +650,18 @@ pub mod runtime_profile_invite_code_admin_list_procedure_result_type;
pub mod runtime_profile_invite_code_admin_procedure_result_type;
pub mod runtime_profile_invite_code_admin_upsert_input_type;
pub mod runtime_profile_invite_code_snapshot_type;
pub mod runtime_profile_membership_benefit_snapshot_type;
pub mod runtime_profile_membership_change_kind_type;
pub mod runtime_profile_membership_cycle_kind_type;
pub mod runtime_profile_membership_model_access_type;
pub mod runtime_profile_membership_order_change_snapshot_type;
pub mod runtime_profile_membership_plan_admin_list_input_type;
pub mod runtime_profile_membership_plan_admin_list_procedure_result_type;
pub mod runtime_profile_membership_plan_admin_procedure_result_type;
pub mod runtime_profile_membership_plan_admin_upsert_input_type;
pub mod runtime_profile_membership_plan_record_type;
pub mod runtime_profile_membership_plan_type;
pub mod runtime_profile_membership_snapshot_type;
pub mod runtime_profile_membership_status_type;
pub mod runtime_profile_membership_tier_type;
pub mod runtime_profile_recharge_center_get_input_type;
pub mod runtime_profile_recharge_center_procedure_result_type;
pub mod runtime_profile_recharge_center_snapshot_type;
@@ -843,6 +851,7 @@ pub use admin_initialize_profile_wallet_consumption_projections_and_return_proce
pub use admin_list_editor_assets_and_return_procedure::admin_list_editor_assets_and_return;
pub use admin_list_editor_showcase_assets_and_return_procedure::admin_list_editor_showcase_assets_and_return;
pub use admin_list_profile_invite_codes_procedure::admin_list_profile_invite_codes;
pub use admin_list_profile_membership_plans_procedure::admin_list_profile_membership_plans;
pub use admin_list_profile_recharge_orders_and_return_procedure::admin_list_profile_recharge_orders_and_return;
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;
@@ -850,6 +859,7 @@ pub use admin_list_profile_task_configs_procedure::admin_list_profile_task_confi
pub use admin_reconcile_profile_wallet_consumption_and_return_procedure::admin_reconcile_profile_wallet_consumption_and_return;
pub use admin_review_editor_showcase_asset_and_return_procedure::admin_review_editor_showcase_asset_and_return;
pub use admin_upsert_profile_invite_code_procedure::admin_upsert_profile_invite_code;
pub use admin_upsert_profile_membership_plan_procedure::admin_upsert_profile_membership_plan;
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;
@@ -1453,12 +1463,18 @@ pub use runtime_profile_invite_code_admin_list_procedure_result_type::RuntimePro
pub use runtime_profile_invite_code_admin_procedure_result_type::RuntimeProfileInviteCodeAdminProcedureResult;
pub use runtime_profile_invite_code_admin_upsert_input_type::RuntimeProfileInviteCodeAdminUpsertInput;
pub use runtime_profile_invite_code_snapshot_type::RuntimeProfileInviteCodeSnapshot;
pub use runtime_profile_membership_benefit_snapshot_type::RuntimeProfileMembershipBenefitSnapshot;
pub use runtime_profile_membership_change_kind_type::RuntimeProfileMembershipChangeKind;
pub use runtime_profile_membership_cycle_kind_type::RuntimeProfileMembershipCycleKind;
pub use runtime_profile_membership_model_access_type::RuntimeProfileMembershipModelAccess;
pub use runtime_profile_membership_order_change_snapshot_type::RuntimeProfileMembershipOrderChangeSnapshot;
pub use runtime_profile_membership_plan_admin_list_input_type::RuntimeProfileMembershipPlanAdminListInput;
pub use runtime_profile_membership_plan_admin_list_procedure_result_type::RuntimeProfileMembershipPlanAdminListProcedureResult;
pub use runtime_profile_membership_plan_admin_procedure_result_type::RuntimeProfileMembershipPlanAdminProcedureResult;
pub use runtime_profile_membership_plan_admin_upsert_input_type::RuntimeProfileMembershipPlanAdminUpsertInput;
pub use runtime_profile_membership_plan_record_type::RuntimeProfileMembershipPlanRecord;
pub use runtime_profile_membership_plan_type::RuntimeProfileMembershipPlan;
pub use runtime_profile_membership_snapshot_type::RuntimeProfileMembershipSnapshot;
pub use runtime_profile_membership_status_type::RuntimeProfileMembershipStatus;
pub use runtime_profile_membership_tier_type::RuntimeProfileMembershipTier;
pub use runtime_profile_recharge_center_get_input_type::RuntimeProfileRechargeCenterGetInput;
pub use runtime_profile_recharge_center_procedure_result_type::RuntimeProfileRechargeCenterProcedureResult;
pub use runtime_profile_recharge_center_snapshot_type::RuntimeProfileRechargeCenterSnapshot;
@@ -3992,19 +4008,19 @@ impl __sdk::SubscriptionHandle for SubscriptionHandle {
/// either a [`DbConnection`] or an [`EventContext`] and operate on either.
pub trait RemoteDbContext:
__sdk::DbContext<
DbView = RemoteTables,
Reducers = RemoteReducers,
SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>,
>
DbView = RemoteTables,
Reducers = RemoteReducers,
SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>,
>
{
}
impl<
Ctx: __sdk::DbContext<
Ctx: __sdk::DbContext<
DbView = RemoteTables,
Reducers = RemoteReducers,
SubscriptionBuilder = __sdk::SubscriptionBuilder<RemoteModule>,
>,
> RemoteDbContext for Ctx
> RemoteDbContext for Ctx
{
}
@@ -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_membership_plan_admin_list_input_type::RuntimeProfileMembershipPlanAdminListInput;
use super::runtime_profile_membership_plan_admin_list_procedure_result_type::RuntimeProfileMembershipPlanAdminListProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct AdminListProfileMembershipPlansArgs {
pub input: RuntimeProfileMembershipPlanAdminListInput,
}
impl __sdk::InModule for AdminListProfileMembershipPlansArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `admin_list_profile_membership_plans`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait admin_list_profile_membership_plans {
fn admin_list_profile_membership_plans(
&self,
input: RuntimeProfileMembershipPlanAdminListInput,
) {
self.admin_list_profile_membership_plans_then(input, |_, _| {});
}
fn admin_list_profile_membership_plans_then(
&self,
input: RuntimeProfileMembershipPlanAdminListInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<RuntimeProfileMembershipPlanAdminListProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl admin_list_profile_membership_plans for super::RemoteProcedures {
fn admin_list_profile_membership_plans_then(
&self,
input: RuntimeProfileMembershipPlanAdminListInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<RuntimeProfileMembershipPlanAdminListProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp.invoke_procedure_with_callback::<_, RuntimeProfileMembershipPlanAdminListProcedureResult>(
"admin_list_profile_membership_plans",
AdminListProfileMembershipPlansArgs { input, },
__callback,
);
}
}
@@ -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_membership_plan_admin_procedure_result_type::RuntimeProfileMembershipPlanAdminProcedureResult;
use super::runtime_profile_membership_plan_admin_upsert_input_type::RuntimeProfileMembershipPlanAdminUpsertInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct AdminUpsertProfileMembershipPlanArgs {
pub input: RuntimeProfileMembershipPlanAdminUpsertInput,
}
impl __sdk::InModule for AdminUpsertProfileMembershipPlanArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `admin_upsert_profile_membership_plan`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait admin_upsert_profile_membership_plan {
fn admin_upsert_profile_membership_plan(
&self,
input: RuntimeProfileMembershipPlanAdminUpsertInput,
) {
self.admin_upsert_profile_membership_plan_then(input, |_, _| {});
}
fn admin_upsert_profile_membership_plan_then(
&self,
input: RuntimeProfileMembershipPlanAdminUpsertInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<RuntimeProfileMembershipPlanAdminProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl admin_upsert_profile_membership_plan for super::RemoteProcedures {
fn admin_upsert_profile_membership_plan_then(
&self,
input: RuntimeProfileMembershipPlanAdminUpsertInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<RuntimeProfileMembershipPlanAdminProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, RuntimeProfileMembershipPlanAdminProcedureResult>(
"admin_upsert_profile_membership_plan",
AdminUpsertProfileMembershipPlanArgs { input },
__callback,
);
}
}
@@ -34,10 +34,10 @@ pub trait get_admin_game_distribution_user_review_and_return {
input: GameDistributionAdminUserReviewInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
@@ -47,10 +47,10 @@ impl get_admin_game_distribution_user_review_and_return for super::RemoteProcedu
input: GameDistributionAdminUserReviewInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, GameDistributionAdminUserReviewResult>(
@@ -31,10 +31,10 @@ pub trait get_game_distribution_my_review_and_return {
input: GameDistributionMyReviewInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<GameDistributionUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
&super::ProcedureEventContext,
Result<GameDistributionUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
@@ -44,10 +44,10 @@ impl get_game_distribution_my_review_and_return for super::RemoteProcedures {
input: GameDistributionMyReviewInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<GameDistributionUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
&super::ProcedureEventContext,
Result<GameDistributionUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, GameDistributionUserReviewResult>(
@@ -34,10 +34,10 @@ pub trait list_admin_game_distribution_user_reviews_and_return {
input: GameDistributionAdminUserReviewListInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
@@ -47,10 +47,10 @@ impl list_admin_game_distribution_user_reviews_and_return for super::RemoteProce
input: GameDistributionAdminUserReviewListInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, GameDistributionAdminUserReviewResult>(
@@ -28,10 +28,10 @@ pub trait list_agc_tracking_events {
query_json: String,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<Result<String, String>, __sdk::InternalError>,
) + Send
+ 'static,
&super::ProcedureEventContext,
Result<Result<String, String>, __sdk::InternalError>,
) + Send
+ 'static,
);
}
@@ -41,10 +41,10 @@ impl list_agc_tracking_events for super::RemoteProcedures {
query_json: String,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<Result<String, String>, __sdk::InternalError>,
) + Send
+ 'static,
&super::ProcedureEventContext,
Result<Result<String, String>, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, Result<String, String>>(
@@ -34,10 +34,10 @@ pub trait list_game_distribution_review_games_and_return {
input: GameDistributionReviewGameListInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
@@ -47,10 +47,10 @@ impl list_game_distribution_review_games_and_return for super::RemoteProcedures
input: GameDistributionReviewGameListInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, GameDistributionAdminUserReviewResult>(
@@ -34,10 +34,10 @@ pub trait list_game_distribution_user_reviews_and_return {
input: GameDistributionUserReviewListInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<GameDistributionUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
&super::ProcedureEventContext,
Result<GameDistributionUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
@@ -47,10 +47,10 @@ impl list_game_distribution_user_reviews_and_return for super::RemoteProcedures
input: GameDistributionUserReviewListInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<GameDistributionUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
&super::ProcedureEventContext,
Result<GameDistributionUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, GameDistributionUserReviewResult>(
@@ -34,10 +34,10 @@ pub trait moderate_game_distribution_user_review_and_return {
input: GameDistributionReviewModerationInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
@@ -47,10 +47,10 @@ impl moderate_game_distribution_user_review_and_return for super::RemoteProcedur
input: GameDistributionReviewModerationInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
&super::ProcedureEventContext,
Result<GameDistributionAdminUserReviewResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, GameDistributionAdminUserReviewResult>(
@@ -3,8 +3,9 @@
#![allow(unused, clippy::all)]
use super::profile_membership_type::ProfileMembership;
use super::runtime_profile_membership_cycle_kind_type::RuntimeProfileMembershipCycleKind;
use super::runtime_profile_membership_plan_type::RuntimeProfileMembershipPlan;
use super::runtime_profile_membership_status_type::RuntimeProfileMembershipStatus;
use super::runtime_profile_membership_tier_type::RuntimeProfileMembershipTier;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `profile_membership`.
@@ -4,15 +4,15 @@
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::runtime_profile_membership_cycle_kind_type::RuntimeProfileMembershipCycleKind;
use super::runtime_profile_membership_plan_type::RuntimeProfileMembershipPlan;
use super::runtime_profile_membership_status_type::RuntimeProfileMembershipStatus;
use super::runtime_profile_membership_tier_type::RuntimeProfileMembershipTier;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct ProfileMembership {
pub user_id: String,
pub status: RuntimeProfileMembershipStatus,
pub tier: RuntimeProfileMembershipTier,
pub started_at: __sdk::Timestamp,
pub expires_at: __sdk::Timestamp,
pub updated_at: __sdk::Timestamp,
@@ -20,7 +20,10 @@ pub struct ProfileMembership {
pub cycle_resets_at: Option<__sdk::Timestamp>,
pub cycle_granted_points: u64,
pub cycle_remaining_points: u64,
pub cycle_period_days: u32,
pub plan: RuntimeProfileMembershipPlan,
pub cycle_index: u32,
pub cycle_count: u32,
pub cycle_kind: RuntimeProfileMembershipCycleKind,
}
impl __sdk::InModule for ProfileMembership {
@@ -33,7 +36,6 @@ impl __sdk::InModule for ProfileMembership {
pub struct ProfileMembershipCols {
pub user_id: __sdk::__query_builder::Col<ProfileMembership, String>,
pub status: __sdk::__query_builder::Col<ProfileMembership, RuntimeProfileMembershipStatus>,
pub tier: __sdk::__query_builder::Col<ProfileMembership, RuntimeProfileMembershipTier>,
pub started_at: __sdk::__query_builder::Col<ProfileMembership, __sdk::Timestamp>,
pub expires_at: __sdk::__query_builder::Col<ProfileMembership, __sdk::Timestamp>,
pub updated_at: __sdk::__query_builder::Col<ProfileMembership, __sdk::Timestamp>,
@@ -41,7 +43,11 @@ pub struct ProfileMembershipCols {
pub cycle_resets_at: __sdk::__query_builder::Col<ProfileMembership, Option<__sdk::Timestamp>>,
pub cycle_granted_points: __sdk::__query_builder::Col<ProfileMembership, u64>,
pub cycle_remaining_points: __sdk::__query_builder::Col<ProfileMembership, u64>,
pub cycle_period_days: __sdk::__query_builder::Col<ProfileMembership, u32>,
pub plan: __sdk::__query_builder::Col<ProfileMembership, RuntimeProfileMembershipPlan>,
pub cycle_index: __sdk::__query_builder::Col<ProfileMembership, u32>,
pub cycle_count: __sdk::__query_builder::Col<ProfileMembership, u32>,
pub cycle_kind:
__sdk::__query_builder::Col<ProfileMembership, RuntimeProfileMembershipCycleKind>,
}
impl __sdk::__query_builder::HasCols for ProfileMembership {
@@ -50,7 +56,6 @@ impl __sdk::__query_builder::HasCols for ProfileMembership {
ProfileMembershipCols {
user_id: __sdk::__query_builder::Col::new(table_name, "user_id"),
status: __sdk::__query_builder::Col::new(table_name, "status"),
tier: __sdk::__query_builder::Col::new(table_name, "tier"),
started_at: __sdk::__query_builder::Col::new(table_name, "started_at"),
expires_at: __sdk::__query_builder::Col::new(table_name, "expires_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
@@ -64,7 +69,10 @@ impl __sdk::__query_builder::HasCols for ProfileMembership {
table_name,
"cycle_remaining_points",
),
cycle_period_days: __sdk::__query_builder::Col::new(table_name, "cycle_period_days"),
plan: __sdk::__query_builder::Col::new(table_name, "plan"),
cycle_index: __sdk::__query_builder::Col::new(table_name, "cycle_index"),
cycle_count: __sdk::__query_builder::Col::new(table_name, "cycle_count"),
cycle_kind: __sdk::__query_builder::Col::new(table_name, "cycle_kind"),
}
}
}
@@ -3,6 +3,9 @@
#![allow(unused, clippy::all)]
use super::profile_recharge_order_type::ProfileRechargeOrder;
use super::runtime_profile_membership_change_kind_type::RuntimeProfileMembershipChangeKind;
use super::runtime_profile_membership_cycle_kind_type::RuntimeProfileMembershipCycleKind;
use super::runtime_profile_membership_plan_type::RuntimeProfileMembershipPlan;
use super::runtime_profile_recharge_order_status_type::RuntimeProfileRechargeOrderStatus;
use super::runtime_profile_recharge_product_kind_type::RuntimeProfileRechargeProductKind;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
@@ -4,6 +4,9 @@
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::runtime_profile_membership_change_kind_type::RuntimeProfileMembershipChangeKind;
use super::runtime_profile_membership_cycle_kind_type::RuntimeProfileMembershipCycleKind;
use super::runtime_profile_membership_plan_type::RuntimeProfileMembershipPlan;
use super::runtime_profile_recharge_order_status_type::RuntimeProfileRechargeOrderStatus;
use super::runtime_profile_recharge_product_kind_type::RuntimeProfileRechargeProductKind;
@@ -27,6 +30,20 @@ pub struct ProfileRechargeOrder {
pub expiration_checked_at: Option<__sdk::Timestamp>,
pub expiration_provider_state: Option<String>,
pub expiration_last_error: Option<String>,
pub membership_change_kind: Option<RuntimeProfileMembershipChangeKind>,
pub membership_plan_before: Option<RuntimeProfileMembershipPlan>,
pub membership_plan_after: Option<RuntimeProfileMembershipPlan>,
pub membership_cycle_kind_before: Option<RuntimeProfileMembershipCycleKind>,
pub membership_cycle_kind_after: Option<RuntimeProfileMembershipCycleKind>,
pub membership_period_points_before: Option<u64>,
pub membership_period_points_after: Option<u64>,
pub membership_granted_points_delta: i64,
pub membership_cycle_index: Option<u32>,
pub membership_expires_at_before: Option<__sdk::Timestamp>,
pub membership_expires_at_after: Option<__sdk::Timestamp>,
pub membership_cycle_resets_at_before: Option<__sdk::Timestamp>,
pub membership_cycle_resets_at_after: Option<__sdk::Timestamp>,
pub membership_price_breakdown_json: Option<String>,
}
impl __sdk::InModule for ProfileRechargeOrder {
@@ -58,6 +75,38 @@ pub struct ProfileRechargeOrderCols {
pub expiration_provider_state:
__sdk::__query_builder::Col<ProfileRechargeOrder, Option<String>>,
pub expiration_last_error: __sdk::__query_builder::Col<ProfileRechargeOrder, Option<String>>,
pub membership_change_kind: __sdk::__query_builder::Col<
ProfileRechargeOrder,
Option<RuntimeProfileMembershipChangeKind>,
>,
pub membership_plan_before:
__sdk::__query_builder::Col<ProfileRechargeOrder, Option<RuntimeProfileMembershipPlan>>,
pub membership_plan_after:
__sdk::__query_builder::Col<ProfileRechargeOrder, Option<RuntimeProfileMembershipPlan>>,
pub membership_cycle_kind_before: __sdk::__query_builder::Col<
ProfileRechargeOrder,
Option<RuntimeProfileMembershipCycleKind>,
>,
pub membership_cycle_kind_after: __sdk::__query_builder::Col<
ProfileRechargeOrder,
Option<RuntimeProfileMembershipCycleKind>,
>,
pub membership_period_points_before:
__sdk::__query_builder::Col<ProfileRechargeOrder, Option<u64>>,
pub membership_period_points_after:
__sdk::__query_builder::Col<ProfileRechargeOrder, Option<u64>>,
pub membership_granted_points_delta: __sdk::__query_builder::Col<ProfileRechargeOrder, i64>,
pub membership_cycle_index: __sdk::__query_builder::Col<ProfileRechargeOrder, Option<u32>>,
pub membership_expires_at_before:
__sdk::__query_builder::Col<ProfileRechargeOrder, Option<__sdk::Timestamp>>,
pub membership_expires_at_after:
__sdk::__query_builder::Col<ProfileRechargeOrder, Option<__sdk::Timestamp>>,
pub membership_cycle_resets_at_before:
__sdk::__query_builder::Col<ProfileRechargeOrder, Option<__sdk::Timestamp>>,
pub membership_cycle_resets_at_after:
__sdk::__query_builder::Col<ProfileRechargeOrder, Option<__sdk::Timestamp>>,
pub membership_price_breakdown_json:
__sdk::__query_builder::Col<ProfileRechargeOrder, Option<String>>,
}
impl __sdk::__query_builder::HasCols for ProfileRechargeOrder {
@@ -96,6 +145,62 @@ impl __sdk::__query_builder::HasCols for ProfileRechargeOrder {
table_name,
"expiration_last_error",
),
membership_change_kind: __sdk::__query_builder::Col::new(
table_name,
"membership_change_kind",
),
membership_plan_before: __sdk::__query_builder::Col::new(
table_name,
"membership_plan_before",
),
membership_plan_after: __sdk::__query_builder::Col::new(
table_name,
"membership_plan_after",
),
membership_cycle_kind_before: __sdk::__query_builder::Col::new(
table_name,
"membership_cycle_kind_before",
),
membership_cycle_kind_after: __sdk::__query_builder::Col::new(
table_name,
"membership_cycle_kind_after",
),
membership_period_points_before: __sdk::__query_builder::Col::new(
table_name,
"membership_period_points_before",
),
membership_period_points_after: __sdk::__query_builder::Col::new(
table_name,
"membership_period_points_after",
),
membership_granted_points_delta: __sdk::__query_builder::Col::new(
table_name,
"membership_granted_points_delta",
),
membership_cycle_index: __sdk::__query_builder::Col::new(
table_name,
"membership_cycle_index",
),
membership_expires_at_before: __sdk::__query_builder::Col::new(
table_name,
"membership_expires_at_before",
),
membership_expires_at_after: __sdk::__query_builder::Col::new(
table_name,
"membership_expires_at_after",
),
membership_cycle_resets_at_before: __sdk::__query_builder::Col::new(
table_name,
"membership_cycle_resets_at_before",
),
membership_cycle_resets_at_after: __sdk::__query_builder::Col::new(
table_name,
"membership_cycle_resets_at_after",
),
membership_price_breakdown_json: __sdk::__query_builder::Col::new(
table_name,
"membership_price_breakdown_json",
),
}
}
}
@@ -3,7 +3,6 @@
#![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};
@@ -4,7 +4,6 @@
#![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)]
@@ -19,17 +18,12 @@ pub struct ProfileRechargeProductConfig {
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,
pub membership_period_points: u64,
pub membership_period_days: u32,
pub membership_queue_limit: u32,
pub membership_discount_bps: u32,
}
impl __sdk::InModule for ProfileRechargeProductConfig {
@@ -52,18 +46,12 @@ pub struct ProfileRechargeProductConfigCols {
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>,
pub membership_period_points: __sdk::__query_builder::Col<ProfileRechargeProductConfig, u64>,
pub membership_period_days: __sdk::__query_builder::Col<ProfileRechargeProductConfig, u32>,
pub membership_queue_limit: __sdk::__query_builder::Col<ProfileRechargeProductConfig, u32>,
pub membership_discount_bps: __sdk::__query_builder::Col<ProfileRechargeProductConfig, u32>,
}
impl __sdk::__query_builder::HasCols for ProfileRechargeProductConfig {
@@ -79,29 +67,12 @@ impl __sdk::__query_builder::HasCols for ProfileRechargeProductConfig {
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"),
membership_period_points: __sdk::__query_builder::Col::new(
table_name,
"membership_period_points",
),
membership_period_days: __sdk::__query_builder::Col::new(
table_name,
"membership_period_days",
),
membership_queue_limit: __sdk::__query_builder::Col::new(
table_name,
"membership_queue_limit",
),
membership_discount_bps: __sdk::__query_builder::Col::new(
table_name,
"membership_discount_bps",
),
}
}
}
@@ -7,24 +7,12 @@ use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
#[derive(Copy, Eq, Hash)]
pub enum RuntimeProfileMembershipTier {
Normal,
pub enum RuntimeProfileMembershipChangeKind {
Purchase,
Month,
Season,
Year,
Starter,
Basic,
Pro,
Ultimate,
Upgrade,
}
impl __sdk::InModule for RuntimeProfileMembershipTier {
impl __sdk::InModule for RuntimeProfileMembershipChangeKind {
type Module = super::RemoteModule;
}
@@ -6,18 +6,13 @@ 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 RuntimeProfileMembershipBenefitSnapshot {
pub benefit_name: String,
pub normal_value: String,
pub month_value: String,
pub season_value: String,
pub year_value: String,
pub starter_value: String,
pub basic_value: String,
pub pro_value: String,
pub ultimate_value: String,
#[derive(Copy, Eq, Hash)]
pub enum RuntimeProfileMembershipCycleKind {
Monthly,
Yearly,
}
impl __sdk::InModule for RuntimeProfileMembershipBenefitSnapshot {
impl __sdk::InModule for RuntimeProfileMembershipCycleKind {
type Module = super::RemoteModule;
}
@@ -0,0 +1,28 @@
// 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 RuntimeProfileMembershipOrderChangeSnapshot {
pub change_kind: String,
pub plan_before: Option<String>,
pub plan_after: Option<String>,
pub cycle_kind_before: Option<String>,
pub cycle_kind_after: Option<String>,
pub period_points_before: Option<u64>,
pub period_points_after: Option<u64>,
pub granted_points_delta: i64,
pub cycle_index: Option<u32>,
pub expires_at_before_micros: Option<i64>,
pub expires_at_after_micros: Option<i64>,
pub cycle_resets_at_before_micros: Option<i64>,
pub cycle_resets_at_after_micros: Option<i64>,
pub price_breakdown_json: Option<String>,
}
impl __sdk::InModule for RuntimeProfileMembershipOrderChangeSnapshot {
type Module = super::RemoteModule;
}

Some files were not shown because too many files have changed in this diff Show More