recommender/internal/entity/User.go

53 lines
1.4 KiB
Go
Raw Normal View History

2024-11-06 10:47:56 +00:00
package entity
2024-11-07 10:09:13 +00:00
import "leafdev.top/Ecosystem/recommender/internal/schema"
2024-11-06 10:47:56 +00:00
type User struct {
2024-11-07 10:09:13 +00:00
Id schema.EntityId `gorm:"primarykey" json:"id"`
Title string `json:"name"`
2024-11-06 10:47:56 +00:00
}
func (u *User) TableName() string {
2024-11-07 10:09:13 +00:00
return "users"
}
2024-11-09 16:11:00 +00:00
type ExternalUser struct {
Model
Id schema.EntityId `gorm:"primarykey" json:"id"`
Name string `json:"name"`
Email string `json:"email"`
ExternalId string `json:"external_id"`
Summary string `json:"summary"`
ApplicationId schema.EntityId `json:"application_id"`
Application *Application
}
func (u *ExternalUser) TableName() string {
return "external_users"
}
2024-11-07 10:09:13 +00:00
type UserLike struct {
2024-11-09 16:11:00 +00:00
ExternalUserId schema.EntityId `gorm:"primarykey" json:"external_user_id"`
PostId schema.EntityId `gorm:"primarykey" json:"post_id"`
Type schema.UserLikeType `json:"type"`
Application *Application
ApplicationId schema.EntityId `json:"application_id"`
2024-11-07 10:09:13 +00:00
}
func (u *UserLike) TableName() string {
return "user_likes"
}
type UserTagScore struct {
2024-11-09 16:11:00 +00:00
ExternalUserId schema.EntityId `gorm:"primarykey" json:"external_user_id"`
TagId schema.EntityId `gorm:"primarykey" json:"tag_id"`
Tag *Tag
Score int `json:"score"`
Application *Application
ApplicationId schema.EntityId `json:"application_id"`
2024-11-07 10:09:13 +00:00
}
func (u *UserTagScore) TableName() string {
return "user_tag_scores"
2024-11-06 10:47:56 +00:00
}