26 lines
1.5 KiB
Go
26 lines
1.5 KiB
Go
package model
|
|
|
|
// TrafficResetLog records every instance where a user's traffic usage was reset.
|
|
type TrafficResetLog struct {
|
|
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
|
|
UserID int `gorm:"not null;index" json:"user_id"`
|
|
ResetType string `gorm:"size:50;not null" json:"reset_type"` // monthly, yearly, manual, purchase
|
|
ResetTime int64 `gorm:"not null;index" json:"reset_time"` // The actual time it was reset
|
|
OldUpload int64 `gorm:"not null;default:0" json:"old_upload"` // pre-reset
|
|
OldDownload int64 `gorm:"not null;default:0" json:"old_download"` // pre-reset
|
|
OldTotal int64 `gorm:"not null;default:0" json:"old_total"` // pre-reset
|
|
NewUpload int64 `gorm:"not null;default:0" json:"new_upload"` // post-reset
|
|
NewDownload int64 `gorm:"not null;default:0" json:"new_download"` // post-reset
|
|
NewTotal int64 `gorm:"not null;default:0" json:"new_total"` // post-reset
|
|
TriggerSource string `gorm:"size:50;not null;default:'auto'" json:"trigger_source"` // auto, manual, cron, order, gift_card
|
|
Metadata string `gorm:"type:text" json:"metadata"` // JSON extra data
|
|
CreatedAt int64 `gorm:"autoCreateTime" json:"created_at"`
|
|
UpdatedAt int64 `gorm:"autoUpdateTime" json:"updated_at"`
|
|
|
|
User *User `gorm:"foreignKey:UserID" json:"user,omitempty"`
|
|
}
|
|
|
|
func (TrafficResetLog) TableName() string {
|
|
return "v2_traffic_reset_logs"
|
|
}
|