feat(conversations): align search message types

This commit is contained in:
2026-06-07 03:40:17 +08:00
parent 9f1ff28521
commit f4ad2fb3c6
3 changed files with 11 additions and 6 deletions
@@ -935,6 +935,7 @@ func (s *ConversationCrudTestSuite) TestSearch_Success() {
assert.Equal(s.T(), s.testContact.Name, resp.Payload[0].Contact["name"])
assert.Equal(s.T(), s.testInbox.Name, resp.Payload[0].Inbox["name"])
assert.NotEmpty(s.T(), resp.Payload[0].Messages)
assert.Equal(s.T(), float64(0), resp.Payload[0].Messages[0]["message_type"])
}
func (s *ConversationCrudTestSuite) TestSearch_InvalidAccountID() {
@@ -94,7 +94,7 @@ type chatwootConversationSearchMessage struct {
Content string `json:"content"`
ID uint `json:"id"`
SenderName string `json:"sender_name,omitempty"`
MessageType string `json:"message_type"`
MessageType int `json:"message_type"`
CreatedAt int64 `json:"created_at"`
}
@@ -189,7 +189,7 @@ func serializeConversationSearch(ctx context.Context, db *gorm.DB, conversation
payload.Messages = append(payload.Messages, chatwootConversationSearchMessage{
Content: messages[i].Content,
ID: messages[i].ID,
MessageType: messages[i].MessageType,
MessageType: messageTypeValue(messages[i].MessageType),
CreatedAt: messages[i].CreatedAt.Unix(),
})
}