feat(labels): align chatwoot label payloads

This commit is contained in:
2026-06-06 00:33:00 +08:00
parent 8b378c79e4
commit 171cbd16d2
10 changed files with 474 additions and 60 deletions
+10 -8
View File
@@ -10,15 +10,17 @@ import (
// 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" json:"color,omitempty"`
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"`
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" }
func (Tag) TableName() string { return "tags" }