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

34 lines
1.6 KiB
Plaintext

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