Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/model/user.go

38 lignes
1,3 Kio
Go
Brut Vue normale Historique

package model
import (
"time"
)
type User struct {
ID uint `gorm:"column:user_id;primary_key"`
2017-05-08 19:26:29 +02:00
Username string `gorm:"column:username"`
Password string `gorm:"column:password"`
Email string `gorm:"column:email"`
Status int `gorm:"column:status"`
CreatedAt time.Time `gorm:"column:created_at"`
UpdatedAt time.Time `gorm:"column:updated_at"`
2017-05-09 12:14:12 +02:00
Token string `gorm:"column:api_token"`
2017-05-08 19:26:29 +02:00
TokenExpiration time.Time `gorm:"column:api_token_expiry"`
Language string `gorm:"column:language"`
2017-05-09 12:14:12 +02:00
// TODO: move this to PublicUser
LikingCount int `json:"likingCount" gorm:"-"`
LikedCount int `json:"likedCount" gorm:"-"`
Likings []User // Don't work `gorm:"foreignkey:user_id;associationforeignkey:follower_id;many2many:user_follows"`
Liked []User // Don't work `gorm:"foreignkey:follower_id;associationforeignkey:user_id;many2many:user_follows"`
2017-05-09 12:14:12 +02:00
MD5 string `json:"md5"` // Hash of email address, used for Gravatar
Torrents []Torrent `gorm:"ForeignKey:UploaderID"`
}
2017-05-08 19:26:29 +02:00
type PublicUser struct {
User *User
}
2017-05-09 17:14:13 +02:00
// different users following eachother
type UserFollows struct {
2017-05-09 12:14:12 +02:00
UserID uint `gorm:"column:user_id"`
FollowerID uint `gorm:"column:following"`
}