19 lines
643 B
Plaintext
19 lines
643 B
Plaintext
package model
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// RelatedCategory represents a category linked to an article (cross-category).
|
|
// Reference: P2B M9 spec
|
|
type RelatedCategory struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
ArticleID uint `gorm:"not null;index" json:"article_id"`
|
|
CategoryID uint `gorm:"not null;index" json:"category_id"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
|
|
|
Article Article `gorm:"foreignKey:ArticleID" json:"article,omitempty"`
|
|
Category Category `gorm:"foreignKey:CategoryID" json:"category,omitempty"`
|
|
}
|
|
|
|
func (RelatedCategory) TableName() string { return "related_categories" } |