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

27 lines
1.2 KiB
Plaintext

package model
import (
"encoding/json"
"time"
)
// Company represents a company/organization for contacts.
// Reference: Chatwoot Company model + P2B M1 spec
type Company 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"`
Description string `gorm:"type:text" json:"description"`
WebsiteURL string `gorm:"size:512" json:"website_url"`
FaviconURL string `gorm:"size:512" json:"favicon_url"`
Domain string `gorm:"size:255" json:"domain"`
LastActivityAt *time.Time `json:"last_activity_at,omitempty"`
CustomAttributes json.RawMessage `gorm:"type:jsonb" json:"custom_attributes"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
Account Account `gorm:"foreignKey:AccountID" json:"account,omitempty"`
Contacts []Contact `gorm:"many2many:company_contacts" json:"contacts,omitempty"`
}
func (Company) TableName() string { return "companies" }