feat(admin): finance dashboard on the home page (#47, slice 1) #148
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/kws!148
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/admin-dashboard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
First slice of #47: a finance dashboard on the admin home page. Later slices add report pages for the other report APIs; the partner report waits for #51.
Design:
docs/superpowers/specs/2026-11-03-admin-dashboard-design.md· Plan:docs/superpowers/plans/2026-11-03-admin-dashboard.mdWhat changes
API:
GET /v1/admin/reports/dashboardadmin_portal.reports.viewat platform scope; rate classheavy;no-store; no parameters (today is the server's Nairobi day).REPEATABLE READ READ ONLYsnapshot, 3 s timeout, which reads the per-day figures of the last 12 months:purchase_priceof those check-ins, a used-ticket figure, not a sales figure.reports.BuildDashboard(plain Go) builds 30 daily and 12 monthly buckets with no gaps. Today, this month and this year come from those buckets.getDashboard, contract live test, rate class andCLAUDE.mdupdated.@kws/uiLineChart:Admin home page: users with
reports.viewsee:The query keeps a minute-old answer and is not retried. A 503 or 429 shows the fixed try-again texts. Money rows with no currency show "—". The page adds nothing up.
Verification
make cover: 91.6 % total (minimum 80 %).make lint0 issues;make contractpasses.Web unit tests: admin 407, ticket 304, ui 52, auth 45, all passing; typecheck is clean.
scripts/web-e2e.sh: ticket 207, admin 131. The admin count includes a new dashboard journey at 320, 768 and 1280 px, with axe checks and no sideways scrolling.Store tests on PostgreSQL cover:
20:59:59Z/21:00:00Z);Builder tests cover gaps, 1 January and overflow.
Real local run against the dev DB: 25 sold and 10 used on 29 October, matching direct SQL counts. The run showed empty money sections for the dev data's free sales; these now show "—".
EXPLAIN on dev: the ranges use
transactions_completed_idxandticket_activities_created_idx.Review:
callandfailureText.Open for the owner
Deferred minors
usedwould count vehicles whilesolddoes not.role=status, and Retry and Refresh show no busy state.@kws/ui.completedDayis a third way of writing the same SQL expression.🤖 Generated with Claude Code