feat: add Sora admin backend and fix type inconsistencies
Backend changes: - Add SoraHandler for admin Sora management APIs - GET /api/v1/admin/sora/stats - system statistics - GET /api/v1/admin/sora/users - user storage stats - GET /api/v1/admin/sora/generations - generation records - DELETE /api/v1/admin/sora/users/:id/storage - clear user storage - Add sora_storage_quota_bytes to AdminUser DTO - Add SoraStorageQuotaBytes to UpdateUserInput for admin user updates - Add comprehensive tests for SoraHandler Frontend changes: - Add soraAdminAPI for Sora management - Add sora_storage_quota_bytes and sora_storage_used_bytes to AdminUser type - Add Sora storage quota field to UserEditModal (GB unit) - Fix UsageLog type: add media_type, fix duration_ms to optional - Fix AdminUsageLog type: add channel_id, billing_tier Test fixes: - Add window.matchMedia mock to AccountUsageCell.spec.ts - Add tlsFingerprintProfileAPI mock to EditAccountModal.spec.ts - Fix loadTLSProfiles function order in EditAccountModal.vue - Fix translation key references in AccountStatusIndicator.spec.ts
This commit is contained in:
@@ -125,6 +125,8 @@ type UpdateUserInput struct {
|
||||
// GroupRates 用户专属分组倍率配置
|
||||
// map[groupID]*rate,nil 表示删除该分组的专属倍率
|
||||
GroupRates map[int64]*float64
|
||||
// Sora 存储配额(单位:字节,0 表示使用分组或系统默认配额)
|
||||
SoraStorageQuotaBytes *int64
|
||||
}
|
||||
|
||||
type CreateGroupInput struct {
|
||||
@@ -628,6 +630,10 @@ func (s *adminServiceImpl) UpdateUser(ctx context.Context, id int64, input *Upda
|
||||
user.AllowedGroups = *input.AllowedGroups
|
||||
}
|
||||
|
||||
if input.SoraStorageQuotaBytes != nil {
|
||||
user.SoraStorageQuotaBytes = *input.SoraStorageQuotaBytes
|
||||
}
|
||||
|
||||
if err := s.userRepo.Update(ctx, user); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user