package model import ( "encoding/json" "time" "gorm.io/gorm" ) // Portal represents a help center / knowledge base portal. // Reference: Chatwoot Portal model + P2B M9 spec type Portal struct { ID uint `gorm:"primaryKey" json:"id"` AccountID uint `gorm:"not null;index" json:"account_id"` Name string `gorm:"size:255;not null" json:"name"` Slug string `gorm:"size:255;not null;uniqueIndex" json:"slug"` Description string `gorm:"type:text" json:"description"` LogoURL string `gorm:"size:512" json:"logo_url"` HomepageContent string `gorm:"type:text" json:"homepage_content"` Locale string `gorm:"size:10;default:'en'" json:"locale"` Archived bool `gorm:"default:false" json:"archived"` CustomDomain string `gorm:"size:255" json:"custom_domain"` PortalConfiguration json.RawMessage `gorm:"type:jsonb" json:"portal_configuration"` CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"` UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"` Account Account `gorm:"foreignKey:AccountID" json:"account,omitempty"` Categories []Category `gorm:"foreignKey:PortalID" json:"categories,omitempty"` Members []PortalMember `gorm:"foreignKey:PortalID" json:"members,omitempty"` Folders []Folder `gorm:"foreignKey:PortalID" json:"folders,omitempty"` } func (Portal) TableName() string { return "portals" }