From ca8d156212936b79b1392f2c64018ca565fc506d Mon Sep 17 00:00:00 2001 From: Tejaswini Chile Date: Mon, 26 Dec 2022 12:55:50 +0530 Subject: [PATCH] fix: added conversation created_at and first message in the text searched conversation data --- .../api/v1/accounts/conversations/text_search.json.jbuilder | 4 ++++ app/views/api/v1/models/_multi_search_message.json.jbuilder | 1 + 2 files changed, 5 insertions(+) diff --git a/app/views/api/v1/accounts/conversations/text_search.json.jbuilder b/app/views/api/v1/accounts/conversations/text_search.json.jbuilder index d4ce5f960..804b7373e 100644 --- a/app/views/api/v1/accounts/conversations/text_search.json.jbuilder +++ b/app/views/api/v1/accounts/conversations/text_search.json.jbuilder @@ -3,6 +3,10 @@ json.payload do json.array! @result[:conversations] do |conversation| json.id conversation.display_id json.account_id conversation.account_id + json.created_at conversation.created_at.to_i + json.message do + json.partial! 'api/v1/models/multi_search_message', formats: [:json], message: conversation.messages.first + end json.contact do json.partial! 'api/v1/models/multi_search_contact', formats: [:json], contact: conversation.contact if conversation.try(:contact).present? end diff --git a/app/views/api/v1/models/_multi_search_message.json.jbuilder b/app/views/api/v1/models/_multi_search_message.json.jbuilder index 81fa3b45f..0175f3211 100644 --- a/app/views/api/v1/models/_multi_search_message.json.jbuilder +++ b/app/views/api/v1/models/_multi_search_message.json.jbuilder @@ -4,6 +4,7 @@ json.message_type message.message_type_before_type_cast json.content_type message.content_type json.source_id message.source_id json.inbox_id message.inbox_id +json.created_at message.created_at.to_i json.agent do if message.conversation.try(:assignee).present? json.partial! 'api/v1/models/multi_search_agent', formats: [:json], agent: message.conversation.try(:assignee)