feat(loyalty): refactor analytics into shared template and add merchant stats API
Some checks failed
CI / ruff (push) Successful in 11s
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / pytest (push) Has been cancelled

Extract analytics stat cards, points activity, and location breakdown
into a shared partial used by admin, merchant, and store dashboards.
Add merchant stats API endpoint and client-side merchant filter on admin
analytics page. Extend stats schema with new_this_month and
estimated_liability_cents fields.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 11:08:16 +01:00
parent 8cf5da6914
commit 6acd783754
11 changed files with 630 additions and 375 deletions

View File

@@ -284,11 +284,17 @@ class MerchantStatsResponse(BaseModel):
total_points_issued: int = 0
total_points_redeemed: int = 0
# Members
new_this_month: int = 0
# Points - last 30 days
points_issued_30d: int = 0
points_redeemed_30d: int = 0
transactions_30d: int = 0
# Value
estimated_liability_cents: int = 0
# Program info (optional)
program: dict | None = None