refactor: move capacity_forecast_service from billing to monitoring
Some checks failed
Some checks failed
Resolves the billing (core) → monitoring (optional) architecture violation by moving CapacityForecastService to the monitoring module where it belongs. - Create BillingMetricsProvider to expose subscription counts via stats_aggregator - Move CapacitySnapshot model from billing to monitoring - Replace direct MerchantSubscription queries with stats_aggregator calls - Fix middleware test mocks to cover StoreDomain/MerchantDomain fallback chains Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -89,6 +89,13 @@ def _get_store_router():
|
||||
return store_router
|
||||
|
||||
|
||||
def _get_metrics_provider():
|
||||
"""Lazy import of metrics provider to avoid circular imports."""
|
||||
from app.modules.billing.services.billing_metrics import billing_metrics_provider
|
||||
|
||||
return billing_metrics_provider
|
||||
|
||||
|
||||
def _get_feature_provider():
|
||||
"""Lazy import of feature provider to avoid circular imports."""
|
||||
from app.modules.billing.services.billing_features import billing_feature_provider
|
||||
@@ -271,6 +278,8 @@ billing_module = ModuleDefinition(
|
||||
],
|
||||
# Feature provider for feature flags
|
||||
feature_provider=_get_feature_provider,
|
||||
# Metrics provider for subscription metrics
|
||||
metrics_provider=_get_metrics_provider,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user