feat(search): align conversation identity search

This commit is contained in:
2026-06-07 08:05:12 +08:00
parent 9a7e455e1c
commit 450c8673d8
9 changed files with 171 additions and 42 deletions
+9 -7
View File
@@ -22,12 +22,12 @@ type Conversation struct {
TeamID *uint `gorm:"index" json:"team_id,omitempty"`
CampaignID *uint `gorm:"index" json:"campaign_id,omitempty"`
SlaPolicyID *uint `gorm:"index" json:"sla_policy_id,omitempty"`
Status string `gorm:"size:50;index;default:open" json:"status"` // open, resolved, pending, snoozed
Priority string `gorm:"size:50;default:none" json:"priority"` // none, low, medium, high, urgent
Status string `gorm:"size:50;index;default:open" json:"status"` // open, resolved, pending, snoozed
Priority string `gorm:"size:50;default:none" json:"priority"` // none, low, medium, high, urgent
ChannelType string `gorm:"size:50;not null" json:"channel_type"`
Channel string `gorm:"size:50;not null" json:"channel"` // channel identifier for routing
Labels string `gorm:"type:text" json:"labels,omitempty"` // comma-separated or JSON label list
SnoozedUntil *int64 `gorm:"index" json:"snoozed_until,omitempty"` // timestamp for snoozed conversations
Channel string `gorm:"size:50;not null" json:"channel"` // channel identifier for routing
Labels string `gorm:"type:text" json:"labels,omitempty"` // comma-separated or JSON label list
SnoozedUntil *int64 `gorm:"index" json:"snoozed_until,omitempty"` // timestamp for snoozed conversations
AdditionalAttributes datatypes.JSON `gorm:"type:jsonb" json:"additional_attributes,omitempty"`
CustomAttributes datatypes.JSON `gorm:"type:jsonb" json:"custom_attributes,omitempty"`
AgentLastSeenAt *int64 `json:"agent_last_seen_at,omitempty"`
@@ -38,9 +38,11 @@ type Conversation struct {
FirstReplyCreatedAt *int64 `json:"first_reply_created_at,omitempty"`
Muted bool `gorm:"default:false" json:"muted"`
ResolvedAt *time.Time `json:"resolved_at,omitempty"` // Chatwoot: timestamp when conversation was resolved
ResumedAt *time.Time `json:"resumed_at,omitempty"` // Chatwoot: timestamp when conversation was reopened
ResumedAt *time.Time `json:"resumed_at,omitempty"` // Chatwoot: timestamp when conversation was reopened
LastMessageAt *int64 `gorm:"index" json:"last_message_at,omitempty"`
LastNonSysMsgAt *int64 `json:"last_non_system_message_at,omitempty"`
Contact *Contact `gorm:"foreignKey:ContactID" json:"contact,omitempty"`
}
// BeforeCreate auto-generates UUID before inserting a new Conversation record.
@@ -51,4 +53,4 @@ func (c *Conversation) BeforeCreate(tx *gorm.DB) error {
return nil
}
func (Conversation) TableName() string { return "conversations" }
func (Conversation) TableName() string { return "conversations" }