Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Status model and field for Users

Cette révision appartient à :
ayame-git 2017-05-07 01:52:27 +03:00
Parent 29fe7045c7
révision a55bb483da
2 fichiers modifiés avec 15 ajouts et 6 suppressions

7
model/status.go Fichier normal
Voir le fichier

@ -0,0 +1,7 @@
package model
//user status e.g. verified, filtered, etc
type Status struct {
Id int `json:"id"`
Name string `json:"name",sql:"size:255"`
}

Voir le fichier

@ -36,14 +36,16 @@ type User struct {
LastLoginIp string `json:"lastLoginIp",sql:"size:100"`
CurrentLoginIp string `json:"currentLoginIp",sql:"size:100"`
Status Status `gorm:"many2one:users_status;"`
// Liking
LikingCount int `json:"likingCount"`
LikedCount int `json:"likedCount"`
Likings []User `gorm:"foreignkey:userId;associationforeignkey:follower_id;many2many:users_followers;"`
Liked []User `gorm:"foreignkey:follower_id;associationforeignkey:userId;many2many:users_followers;"`
LikingCount int `json:"likingCount"`
LikedCount int `json:"likedCount"`
Likings []User `gorm:"foreignkey:userId;associationforeignkey:follower_id;many2many:users_followers;"`
Liked []User `gorm:"foreignkey:follower_id;associationforeignkey:userId;many2many:users_followers;"`
Connections []Connection
Roles []Role `gorm:"many2many:users_roles;"` // Many To Many, users_roles
Roles []Role `gorm:"many2many:users_roles;"` // Many To Many, users_roles
Torrents []Torrents
}
@ -77,7 +79,7 @@ type PublicUser struct {
Connections omit `json:"connections,omitempty"`
Roles omit `json:"roles,omitempty"`
Torrents omit `json:"articles,omitempty"`
Torrents omit `json:"articles,omitempty"` //should user torrents not be displayed?
}
// Connection is a connection model for oauth.