Fix quota_used returning old value when there were no messages today
This commit is contained in:
parent
3c5da802a7
commit
cdb92757aa
@ -11,7 +11,7 @@ type User struct {
|
||||
TimestampLastRead *SCNTime `db:"timestamp_lastread" json:"timestamp_lastread"`
|
||||
TimestampLastSent *SCNTime `db:"timestamp_lastsent" json:"timestamp_lastsent"`
|
||||
MessagesSent int `db:"messages_sent" json:"messages_sent"`
|
||||
QuotaUsed int `db:"quota_used" json:"quota_used"`
|
||||
QuotaUsed int `db:"quota_used" json:"-"`
|
||||
QuotaUsedDay *string `db:"quota_used_day" json:"-"`
|
||||
IsPro bool `db:"is_pro" json:"is_pro"`
|
||||
ProToken *string `db:"pro_token" json:"-"`
|
||||
@ -22,6 +22,7 @@ type User struct {
|
||||
type UserExtra struct {
|
||||
QuotaRemaining int `json:"quota_remaining"`
|
||||
QuotaPerDay int `json:"quota_max"`
|
||||
QuotaUsed int `json:"quota_used"`
|
||||
DefaultChannel string `json:"default_channel"`
|
||||
MaxBodySize int `json:"max_body_size"`
|
||||
MaxTitleLength int `json:"max_title_length"`
|
||||
@ -58,6 +59,7 @@ func (u User) WithClients(clients []Client, ak string, sk string, rk string) Use
|
||||
func (u *User) PreMarshal() User {
|
||||
u.UserExtra = UserExtra{
|
||||
QuotaPerDay: u.QuotaPerDay(),
|
||||
QuotaUsed: u.QuotaUsedToday(),
|
||||
QuotaRemaining: u.QuotaRemainingToday(),
|
||||
DefaultChannel: u.DefaultChannel(),
|
||||
MaxBodySize: u.MaxContentLength(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user