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

24 lines
1.0 KiB
Go

package model
import (
"encoding/json"
)
// Folder represents a folder within a category for organizing articles.
// Reference: Chatwoot Folder model + P2B M9 spec
type Folder struct {
Base
AccountID uint `gorm:"index;not null" json:"account_id"`
PortalID uint `gorm:"index;not null" json:"portal_id"`
CategoryID uint `gorm:"index;not null" json:"category_id"`
Name string `gorm:"size:255;not null" json:"name"`
ParentID *uint `gorm:"index" json:"parent_id,omitempty"`
CustomAttributes json.RawMessage `gorm:"type:jsonb;serializer:json" json:"custom_attributes"`
Portal Portal `gorm:"foreignKey:PortalID" json:"portal,omitempty"`
Category Category `gorm:"foreignKey:CategoryID" json:"category,omitempty"`
Parent *Folder `gorm:"foreignKey:ParentID" json:"parent,omitempty"`
Articles []Article `gorm:"foreignKey:FolderID" json:"articles,omitempty"`
}
func (Folder) TableName() string { return "folders" }