From 18a3b8dd2f44307d690b78902a70273117b2e606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-X=2E=20T=2E?= Date: Wed, 24 Jun 2026 15:22:54 -0400 Subject: [PATCH 1/2] feat(labrinth): include next charge's tax amount --- apps/labrinth/src/routes/internal/billing.rs | 27 ++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/apps/labrinth/src/routes/internal/billing.rs b/apps/labrinth/src/routes/internal/billing.rs index 6d3f8f6ec8..41735e95f3 100644 --- a/apps/labrinth/src/routes/internal/billing.rs +++ b/apps/labrinth/src/routes/internal/billing.rs @@ -99,6 +99,13 @@ struct SubscriptionsQuery { pub user_id: Option, } +#[derive(Serialize)] +struct UserSubscriptionWithNextChargeTaxAmount { + #[serde(flatten)] + pub subscription: UserSubscription, + pub next_charge_tax_amount: Option, +} + #[get("subscriptions")] pub async fn subscriptions( req: HttpRequest, @@ -117,7 +124,7 @@ pub async fn subscriptions( .await? .1; - let subscriptions = + let db_subscriptions = user_subscription_item::DBUserSubscription::get_all_user( if let Some(user_id) = query.user_id { if user.role.is_admin() { @@ -133,10 +140,20 @@ pub async fn subscriptions( }, &**pool, ) - .await? - .into_iter() - .map(UserSubscription::from) - .collect::>(); + .await?; + + let mut subscriptions = Vec::with_capacity(db_subscriptions.len()); + for subscription in db_subscriptions { + let next_charge_tax_amount = + DBCharge::get_open_subscription(subscription.id, &**pool) + .await? + .map(|charge| charge.tax_amount); + + subscriptions.push(UserSubscriptionWithNextChargeTaxAmount { + subscription: UserSubscription::from(subscription), + next_charge_tax_amount, + }); + } Ok(HttpResponse::Ok().json(subscriptions)) } From 95ea66b8c332f83fe6e769937023e1b97e87650f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-X=2E=20T=2E?= Date: Wed, 24 Jun 2026 15:23:16 -0400 Subject: [PATCH 2/2] chore(api-client): add next_charge_tax_amount --- packages/api-client/src/modules/labrinth/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/api-client/src/modules/labrinth/types.ts b/packages/api-client/src/modules/labrinth/types.ts index 95dca046ee..ea5be7b750 100644 --- a/packages/api-client/src/modules/labrinth/types.ts +++ b/packages/api-client/src/modules/labrinth/types.ts @@ -26,6 +26,7 @@ export namespace Labrinth { status: SubscriptionStatus created: string metadata?: SubscriptionMetadata + next_charge_tax_amount?: number | null } export type SubscriptionMetadata =