2022-09-30 18:14:05 +03:00
|
|
|
package models
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
type LeaderboardItem struct {
|
|
|
|
ID uint `json:"-" gorm:"primary_key; size:32"`
|
|
|
|
User *User `json:"-" gorm:"not null; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
|
|
|
|
UserID string `json:"user_id" gorm:"not null; index:idx_leaderboard_user"`
|
2022-10-02 01:01:39 +03:00
|
|
|
Rank uint `json:"rank" gorm:"->"`
|
2022-09-30 18:14:05 +03:00
|
|
|
Interval string `json:"interval" gorm:"not null; size:32; index:idx_leaderboard_combined"`
|
2022-10-02 01:01:39 +03:00
|
|
|
By *uint8 `json:"aggregated_by" gorm:"index:idx_leaderboard_combined"` // pointer because nullable
|
2022-09-30 18:14:05 +03:00
|
|
|
Total time.Duration `json:"total" gorm:"not null" swaggertype:"primitive,integer"`
|
2022-10-02 01:01:39 +03:00
|
|
|
Key *string `json:"key" gorm:"size:255"` // pointer because nullable
|
2022-09-30 18:14:05 +03:00
|
|
|
CreatedAt CustomTime `gorm:"type:timestamp; default:CURRENT_TIMESTAMP" swaggertype:"string" format:"date" example:"2006-01-02 15:04:05.000"`
|
|
|
|
}
|