refactor(sora): remove per-user storage quota fields and simplify quota service
- Remove SoraStorageQuotaBytes/SoraStorageUsedBytes from User/Group schema (Ent ORM) - Regenerate ent code (-582 lines net reduction) - Clean up stale references in sora_handler.go (4 sites) and service.User struct - Simplify SoraQuotaService constructor (3-param -> 1-param, system-default only) - Add Deprecated marker + HTTP headers to ClearUserStorage API - Change AddUsage/ReleaseUsage log level to Debug - Add 9 unit tests for simplified SoraQuotaService (boundary/negative/nil-safe) - Fix test files to remove deleted field references Code review: 8.0/10 overall rating, 0 critical issues remaining.
This commit is contained in:
@@ -155,15 +155,12 @@ func TestNewSoraHandler(t *testing.T) {
|
||||
|
||||
func TestUser_SoraFields(t *testing.T) {
|
||||
user := &service.User{
|
||||
ID: 1,
|
||||
Email: "test@example.com",
|
||||
SoraStorageQuotaBytes: 10 * 1024 * 1024 * 1024,
|
||||
SoraStorageUsedBytes: 1 * 1024 * 1024 * 1024,
|
||||
ID: 1,
|
||||
Email: "test@example.com",
|
||||
}
|
||||
|
||||
assert.Equal(t, int64(1), user.ID)
|
||||
assert.Equal(t, int64(10*1024*1024*1024), user.SoraStorageQuotaBytes)
|
||||
assert.Equal(t, int64(1*1024*1024*1024), user.SoraStorageUsedBytes)
|
||||
assert.Equal(t, "test@example.com", user.Email)
|
||||
}
|
||||
|
||||
func TestQuotaInfo_Fields(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user