2017-05-06 17:55:02 +02:00
package model
import (
"time"
)
// omit is the bool type for omitting a field of struct.
type omit bool
type User struct {
2017-05-08 19:26:29 +02:00
Id uint ` gorm:"column:user_id;primary_key" `
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" `
/*Api*/ Token string ` gorm:"column:api_token" `
//ApiTokenExpiry
2017-05-09 03:36:48 +02:00
// 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;" `
Md5 string ` json:"md5" `
2017-05-08 19:26:29 +02:00
TokenExpiration time . Time ` gorm:"column:api_token_expiry" `
Language string ` gorm:"column:language" `
2017-05-09 03:36:48 +02:00
Torrents [ ] Torrents ` gorm:"ForeignKey:owner_id" `
2017-05-06 17:55:02 +02:00
}
2017-05-08 19:26:29 +02:00
type PublicUser struct {
2017-05-08 20:21:11 +02:00
User * User
2017-05-06 17:55:02 +02:00
}
2017-05-09 03:36:48 +02:00
// UsersFollowers is a relation table to relate users each other.
type UsersFollowers struct {
UserID uint ` gorm:"column:userId" `
FollowerID uint ` gorm:"column:follower_id" `
}