feat: add single endpoint for merchant subscriptions with usage data

Replace N+1 per-platform API calls on merchant detail page with a single
GET /admin/subscriptions/merchants/{id} endpoint. Extract shared
subscription+usage aggregation logic into a reusable service method and
refactor the store endpoint to use it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-22 20:58:02 +01:00
parent b9ac252a9f
commit 42b894094a
4 changed files with 92 additions and 66 deletions

View File

@@ -146,7 +146,8 @@ class SubscriptionService:
return (
db.query(MerchantSubscription)
.options(
joinedload(MerchantSubscription.tier),
joinedload(MerchantSubscription.tier)
.joinedload(SubscriptionTier.feature_limits),
joinedload(MerchantSubscription.platform),
)
.filter(MerchantSubscription.merchant_id == merchant_id)