Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(admin): add admin cash-flow control dashboard#24

Merged
Clark1945 merged 1 commit into
masterfrom
feature/admin-cashflow-dashboard
Jun 29, 2026
Merged

feat(admin): add admin cash-flow control dashboard#24
Clark1945 merged 1 commit into
masterfrom
feature/admin-cashflow-dashboard

Conversation

@Clark1945

Copy link
Copy Markdown
Owner

πŸ“‹ Summary

Adds an admin-only cash-flow control dashboard to wallet_system: admins see platform-wide stats and a paginated, filterable view of every user's transactions.

🎯 Motivation

The app previously only let each user see their own wallet's transactions. Operators need a back-office view to monitor all money movement across the platform.

πŸ”§ Changes

  • Admin flag & routing β€” new Member.isAdmin (Flyway V6); form-login and Google-OAuth flows route admins to /admin instead of /dashboard, stamping an IS_ADMIN session flag.
  • Access control β€” AdminAuthInterceptor gates /admin/** via the session flag (non-admins redirected to /dashboard), consistent with the existing session-based authorization (no Spring roles introduced).
  • Query layer β€” TransactionSpec.adminFilter (all wallets + status + order-number + date range); order number matches either the transaction UUID or the gateway paymentExternalId. New repository aggregates for per-status counts, completed deposit/withdrawal totals, and total wallet balance.
  • Admin module β€” AdminService (stats + resolves each transaction's initiating member into name/actorId), AdminDashboardController, and AdminStats/AdminTxView DTOs.
  • UI & i18n β€” admin-dashboard.html (stat cards, filter form, transaction table, pagination) reusing the existing dashboard styling; admin message keys for en/ja/zh-TW.
  • Tooling β€” harden scripts/dev-up.ps1 so benign git stderr warnings (e.g. LF/CRLF) no longer abort version detection under $ErrorActionPreference='Stop'.

πŸ§ͺ How to Test

  1. cd wallet_system && ./mvnw test β€” full suite green (256 tests).
  2. docker compose up --build, then UPDATE members SET is_admin=true WHERE email='[email protected]';.
  3. Log in as that account β†’ redirected to /admin; verify stats, the status / order-number / date-range filters, 10-per-page pagination, and the name/actorId columns.
  4. Log in as a normal account β†’ stays on /dashboard; hitting /admin directly redirects back to /dashboard.

⚠️ Notes / Risks

  • Adds Flyway migration V6__add_is_admin_to_members.sql (additive column, default false).
  • No admin account is auto-created β€” promote manually via SQL.
  • Authorization intentionally stays session-based (no Spring Security roles) to match existing patterns.

βœ… Checklist

  • Tests written or updated
  • New-code coverage β‰₯ 80% (96.8%)
  • Tested locally
  • No hardcoded secrets or credentials

πŸ€– Generated with Claude Code

Add an admin-only dashboard for platform-wide cash-flow oversight.
Members gain an isAdmin flag (Flyway V6); admins are routed to /admin
on login (form + OAuth) instead of /dashboard, and /admin/** is gated
by a session-based AdminAuthInterceptor that redirects non-admins.

The dashboard shows aggregate stats (member count, per-status tx
counts, completed deposit/withdrawal totals, total wallet balance) and
a paginated, filterable table of every wallet's transactions
(name, actorId, transactionId, status, time). Filtering supports date
range, transaction status, and an order number matching either the
transaction UUID or the gateway paymentExternalId, via a new
TransactionSpec.adminFilter and repository aggregate queries. i18n
keys added for en/ja/zh-TW.

Also harden scripts/dev-up.ps1: relax $ErrorActionPreference around the
git version-detection calls so benign stderr warnings (e.g. LF/CRLF) no
longer abort the script under 'Stop'.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@Clark1945 Clark1945 merged commit 119d111 into master Jun 29, 2026
7 checks passed
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.

1 participant