recommender/internal/entity/Post.go
2024-11-08 02:25:15 +08:00

33 lines
858 B
Go

package entity
import "leafdev.top/Ecosystem/recommender/internal/schema"
type Post struct {
Model
Title string `json:"title"`
Content string `json:"content"`
TargetId string `json:"target_id"`
ApplicationId schema.EntityId `json:"application_id"`
Application *Application `json:"application"`
Category *Category `json:"category"`
CategoryId *schema.EntityId `json:"category_id"`
Processed bool `json:"processed"`
}
func (u *Post) TableName() string {
return "posts"
}
type PostTag struct {
Id schema.EntityId `gorm:"primarykey" json:"id"`
PostId *schema.EntityId `gorm:"primarykey" json:"post_id"`
Post *Post
TagId *schema.EntityId `gorm:"primarykey" json:"tag_id"`
Tag *Tag
}
func (u *PostTag) TableName() string {
return "post_tags"
}