Files
gochat/internal/model/related_category.go.txt
T
2026-06-04 15:44:48 +08:00

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" }