-
Notifications
You must be signed in to change notification settings - Fork 363
feat(admin): add balance management page #487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
s-Joshua-s
wants to merge
8
commits into
Wei-Shaw:main
Choose a base branch
from
s-Joshua-s:feat/admin-balance-management
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(admin): add balance management page #487
s-Joshua-s
wants to merge
8
commits into
Wei-Shaw:main
from
s-Joshua-s:feat/admin-balance-management
+1,043
−5
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add GetBalanceGroupUserStats to repository with CTE aggregation query, JOIN with users table, ILIKE search with metacharacter escaping, and whitelisted sort columns. Add service method with parameter validation including 90-day max range and sort column whitelist. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Create BalanceHandler with GetStats endpoint parsing query params. Register in wire ProviderSet, AdminHandlers struct, and wire_gen.go. Add GET /admin/balance/stats route. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Create balance.ts with TypeScript interfaces and getBalanceGroupUserStats API function. Register in admin API barrel export. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement full-featured balance management page with group selector (standard type only), date range picker (90-day max), debounced search, server-side sort/pagination DataTable, model distribution dialog, balance deposit modal, and balance history modal. Includes empty states and cost/token formatting helpers. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add admin.balance namespace translations for zh and en locales. Add WalletIcon and balance nav item to admin sidebar (hidden in simple mode). Register /admin/balance route with lazy loading. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Handler: distinguish validation errors (400) from internal errors (500), log internal errors server-side instead of exposing to client - Repo: add nil pointer guard for StartDate/EndDate parameters - Frontend: add AbortController for request cancellation to prevent race conditions, clean up debounce timer on unmount, remove unused watch import Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add BalanceGroupUserStats, BalanceGroupUserStatsResponse, and BalanceGroupUserStatsParams type definitions. Add composite index on (group_id, created_at) for usage_log to optimize balance queries. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix gofmt formatting issue in usage_log_repo.go (map alignment) - Add missing GetBalanceGroupUserStats method to stubUsageLogRepo in tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Owner
Contributor
Contributor
Owner
|
感觉多开一个页面有点多余 |
Contributor
因为我们的分组 区分为 余额类型 和 订阅类型,这两个功能是并列的。 而且从用户使用习惯来讲,我在侧标签看到了订阅管理,也会第一时间想着从对应的位置找到余额分组管理。 直接放到账户管理再加个筛选也行,但是感觉不够直观,容易找不到入口 |
Contributor
怎么说大佬,要咋改 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Backend (10 files)
BalanceGroupUserStats,BalanceGroupUserStatsResponse,BalanceGroupUserStatsParams(group_id, created_at)onusage_logsGetBalanceGroupUserStatswith CTE aggregation, JOIN users, ILIKE search (with metacharacter escaping), parameterized queries, whitelist-based sortGET /admin/balance/statswith validation/internal error distinctionFrontend (7 files)
getBalanceGroupUserStatswith AbortSignal supportadmin.balancenamespace in zh.ts and en.ts/admin/balanceroute with admin auth guardSecurity
%,_,\)Test plan
🤖 Generated with Claude Code