Files
gochat/internal/model/tag.go
T

27 lines
1.1 KiB
Go

package model
import (
"time"
"gorm.io/gorm"
)
// Tag represents a label/tag used across conversations and contacts.
// Reference: Chatwoot Tag + Taggings merged + P2B M4 spec
// Each tag belongs to an account and has a unique name within that account.
type Tag struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
AccountID uint `gorm:"not null;uniqueIndex:idx_tag_account_name" json:"account_id"`
Name string `gorm:"size:255;not null;uniqueIndex:idx_tag_account_name" json:"name"`
Color string `gorm:"size:50;not null;default:#1f93ff" json:"color,omitempty"`
Description string `gorm:"type:text" json:"description,omitempty"`
ShowOnSidebar *bool `json:"show_on_sidebar"`
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"`
}
func (Tag) TableName() string { return "tags" }