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

28 lines
1.2 KiB
Go

package model
import (
"time"
"gorm.io/datatypes"
)
// 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 datatypes.JSON `gorm:"type:jsonb;default:'{}'" json:"custom_attributes,omitempty"`
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" }