diff --git a/main.go b/main.go index 90fddb9..01bfdc7 100644 --- a/main.go +++ b/main.go @@ -110,8 +110,8 @@ type Service struct { } type CompressionSettings struct { - Algorithm string `yaml:"algorithm" validate:"omitempty,oneof=gzip brotli zstd"` - Level float64 `yaml:"level" validate:"omitempty,min=1,max=22"` + Algorithm string `yaml:"algorithm" validate:"omitempty,oneof=gzip brotli zstd"` + Level int `yaml:"level" validate:"omitempty,min=1,max=22"` } type RouterAndCompression struct { diff --git a/services-src/storage/main.go b/services-src/storage/main.go index fda604e..3edb344 100644 --- a/services-src/storage/main.go +++ b/services-src/storage/main.go @@ -79,7 +79,7 @@ func addQuota(information library.ServiceInitializationInformation, message libr respondError(err.Error(), information, true, message.ServiceID) } } else { - _, err := conn.DB.Exec("INSERT INTO users (id, quota, reserved) VALUES ($1, $2, 0)", message.Message.(nucleusLibrary.Quota).User, int64(information.Configuration["defaultQuota"].(float64))+message.Message.(nucleusLibrary.Quota).Bytes) + _, err := conn.DB.Exec("INSERT INTO users (id, quota, reserved) VALUES ($1, $2, 0)", message.Message.(nucleusLibrary.Quota).User, int64(information.Configuration["defaultQuota"].(int))+message.Message.(nucleusLibrary.Quota).Bytes) if err != nil { respondError(err.Error(), information, true, message.ServiceID) } @@ -109,11 +109,11 @@ func addReserved(information library.ServiceInitializationInformation, message l } } else { // Check if the user has enough space - if int64(information.Configuration["defaultQuota"].(float64)) < message.Message.(nucleusLibrary.Quota).Bytes { + if int64(information.Configuration["defaultQuota"].(int)) < message.Message.(nucleusLibrary.Quota).Bytes { respondError("insufficient storage", information, false, message.ServiceID) return } - _, err := conn.DB.Exec("INSERT INTO users (id, quota, reserved) VALUES ($1, $2, $3)", message.Message.(nucleusLibrary.Quota).User, int64(information.Configuration["defaultQuota"].(float64)), message.Message.(nucleusLibrary.Quota).Bytes) + _, err := conn.DB.Exec("INSERT INTO users (id, quota, reserved) VALUES ($1, $2, $3)", message.Message.(nucleusLibrary.Quota).User, int64(information.Configuration["defaultQuota"].(int)), message.Message.(nucleusLibrary.Quota).Bytes) if err != nil { respondError(err.Error(), information, true, message.ServiceID) }