mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-20 15:06:36 +00:00
feat(groups): batch adjust rate multipliers with global factor
- Add PUT /admin/groups/:id/rate-multipliers batch endpoint - Add batch adjust UI: multiply all rates by a factor (e.g., ×0.5 to halve, ×2 to restore) - Remove inline rate editing (blur-save), rates now display as read-only - Backend: SyncGroupRateMultipliers repo method (delete + batch upsert)
This commit is contained in:
1 parent
5e98771cf7
commit
979e1c1bf5
13 files changed
+210
-34
No files matched your search
@@ -44,6 +44,7 @@ type AdminService interface {
|
||||
GetGroupAPIKeys(ctx context.Context, groupID int64, page, pageSize int) ([]APIKey, int64, error)
|
||||
GetGroupRateMultipliers(ctx context.Context, groupID int64) ([]UserGroupRateEntry, error)
|
||||
ClearGroupRateMultipliers(ctx context.Context, groupID int64) error
|
||||
BatchSetGroupRateMultipliers(ctx context.Context, groupID int64, entries []GroupRateMultiplierInput) error
|
||||
UpdateGroupSortOrders(ctx context.Context, updates []GroupSortOrderUpdate) error
|
||||
|
||||
// API Key management (admin)
|
||||
@@ -1279,6 +1280,13 @@ func (s *adminServiceImpl) ClearGroupRateMultipliers(ctx context.Context, groupI
|
||||
return s.userGroupRateRepo.DeleteByGroupID(ctx, groupID)
|
||||
}
|
||||
|
||||
func (s *adminServiceImpl) BatchSetGroupRateMultipliers(ctx context.Context, groupID int64, entries []GroupRateMultiplierInput) error {
|
||||
if s.userGroupRateRepo == nil {
|
||||
return nil
|
||||
}
|
||||
return s.userGroupRateRepo.SyncGroupRateMultipliers(ctx, groupID, entries)
|
||||
}
|
||||
|
||||
func (s *adminServiceImpl) UpdateGroupSortOrders(ctx context.Context, updates []GroupSortOrderUpdate) error {
|
||||
return s.groupRepo.UpdateSortOrders(ctx, updates)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user