Skip to content

fix(billing): rank Top spenders server-side across all users - #428

Open
karpikpl wants to merge 1 commit into
mainfrom
copilot/fix-issue-417
Open

fix(billing): rank Top spenders server-side across all users#428
karpikpl wants to merge 1 commit into
mainfrom
copilot/fix-issue-417

Conversation

@karpikpl

Copy link
Copy Markdown
Collaborator

Fixes #417

Summary

  • Add a DB-backed /api/billing-credits-top-users endpoint with default top 10 and configurable limit/metric query params.
  • Rank top spenders with a single SUM(...) GROUP BY username query across all ingested billing rows.
  • Update the Billing tab chart to consume the server-side global ranking instead of lazy-loaded table rows.

Validation

  • Added failing regression coverage first for global top-N behavior.
  • npm test -- tests/billing-credit-reader.spec.ts tests/billing-credits.db-first.spec.ts
  • npm run build

Note: full npm test currently fails in this symlinked worktree on Nuxt test-utils resolving /@fs/... before any tests run; targeted non-Nuxt regression tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bbf27d66-9aca-451b-85ee-3a32e0775d52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Billing "Top spenders" chart can only rank across lazy-loaded rows — no global top-N query

1 participant