fix: tier to use AccountTier struct

This commit is contained in:
Derrick Hammer 2024-01-17 12:38:52 -05:00
parent 1cf2d9880c
commit a5cbb4c4fb
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 28 additions and 7 deletions

View File

@ -17,6 +17,7 @@ import (
"go.sia.tech/jape" "go.sia.tech/jape"
"go.uber.org/zap" "go.uber.org/zap"
"io" "io"
"math"
"mime/multipart" "mime/multipart"
"net/http" "net/http"
"strings" "strings"
@ -529,7 +530,13 @@ func (h *HttpHandler) AccountInfo(jc jape.Context) {
QuotaExceeded: false, QuotaExceeded: false,
EmailConfirmed: false, EmailConfirmed: false,
IsRestricted: false, IsRestricted: false,
Tier: 0, Tier: AccountTier{
Id: 1,
Name: "default",
UploadBandwidth: math.MaxUint64,
StorageLimit: math.MaxUint64,
Scopes: []interface{}{},
},
} }
jc.Encode(info) jc.Encode(info)
@ -544,7 +551,13 @@ func (h *HttpHandler) AccountStats(jc jape.Context) {
QuotaExceeded: false, QuotaExceeded: false,
EmailConfirmed: false, EmailConfirmed: false,
IsRestricted: false, IsRestricted: false,
Tier: 0, Tier: AccountTier{
Id: 1,
Name: "default",
UploadBandwidth: math.MaxUint64,
StorageLimit: math.MaxUint64,
Scopes: []interface{}{},
},
}, },
Stats: AccountStats{ Stats: AccountStats{
Total: AccountStatsTotal{ Total: AccountStatsTotal{

View File

@ -23,11 +23,11 @@ type AccountLoginChallengeResponse struct {
Challenge string `json:"challenge"` Challenge string `json:"challenge"`
} }
type AccountInfoResponse struct { type AccountInfoResponse struct {
Email string `json:"email"` Email string `json:"email"`
QuotaExceeded bool `json:"quotaExceeded"` QuotaExceeded bool `json:"quotaExceeded"`
EmailConfirmed bool `json:"emailConfirmed"` EmailConfirmed bool `json:"emailConfirmed"`
IsRestricted bool `json:"isRestricted"` IsRestricted bool `json:"isRestricted"`
Tier uint8 `json:"tier"` Tier AccountTier `json:"tier"`
} }
type AccountStatsResponse struct { type AccountStatsResponse struct {
@ -35,6 +35,14 @@ type AccountStatsResponse struct {
Stats AccountStats `json:"stats"` Stats AccountStats `json:"stats"`
} }
type AccountTier struct {
Id uint64 `json:"id"`
Name string `json:"name"`
UploadBandwidth uint64 `json:"uploadBandwidth"`
StorageLimit uint64 `json:"storageLimit"`
Scopes []interface{} `json:"scopes"`
}
type AccountStats struct { type AccountStats struct {
Total AccountStatsTotal `json:"total"` Total AccountStatsTotal `json:"total"`
} }