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

17 lines
657 B
Go

package model
// RelatedCategory represents a many-to-many relationship between categories.
// Reference: Chatwoot RelatedCategory model + P2B M9 spec
// This is the join table: category_id → related_category_id
type RelatedCategory struct {
Base
CategoryID uint `gorm:"not null;index" json:"category_id"`
RelatedCategoryID uint `gorm:"not null;index" json:"related_category_id"`
Category Category `gorm:"foreignKey:CategoryID" json:"category,omitempty"`
RelatedCategory Category `gorm:"foreignKey:RelatedCategoryID" json:"related_category,omitempty"`
}
func (RelatedCategory) TableName() string { return "related_categories" }