fix: use metrics provider pattern for merchant dashboard stats
The merchant dashboard was showing subscription count as "Total Stores". Add get_merchant_metrics() to MetricsProviderProtocol and implement it in tenancy, billing, and customer providers. Dashboard now fetches real stats from a new /merchants/core/dashboard/stats endpoint and displays 4 cards: active subscriptions, total stores, customers, team members. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -207,6 +207,28 @@ class MetricsProviderProtocol(Protocol):
|
||||
"""
|
||||
...
|
||||
|
||||
def get_merchant_metrics(
|
||||
self,
|
||||
db: "Session",
|
||||
merchant_id: int,
|
||||
context: MetricsContext | None = None,
|
||||
) -> list[MetricValue]:
|
||||
"""
|
||||
Get metrics scoped to a specific merchant.
|
||||
|
||||
Called by the merchant dashboard to display merchant-scoped statistics.
|
||||
Should only include data belonging to the specified merchant.
|
||||
|
||||
Args:
|
||||
db: Database session for queries
|
||||
merchant_id: ID of the merchant to get metrics for
|
||||
context: Optional filtering/scoping context
|
||||
|
||||
Returns:
|
||||
List of MetricValue objects for this merchant
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
__all__ = [
|
||||
"MetricValue",
|
||||
|
||||
Reference in New Issue
Block a user