2020-11-07 20:16:45 +00:00
|
|
|
json.meta do
|
|
|
|
json.mine_count @conversations_count[:mine_count]
|
|
|
|
json.unassigned_count @conversations_count[:unassigned_count]
|
|
|
|
json.all_count @conversations_count[:all_count]
|
|
|
|
end
|
|
|
|
json.payload do
|
|
|
|
json.array! @conversations do |conversation|
|
|
|
|
json.id conversation.display_id
|
2021-03-15 13:08:05 +00:00
|
|
|
json.created_at conversation.created_at.to_i
|
|
|
|
json.contact do
|
|
|
|
json.id conversation.contact.id
|
|
|
|
json.name conversation.contact.name
|
|
|
|
end
|
|
|
|
json.inbox do
|
|
|
|
json.id conversation.inbox.id
|
|
|
|
json.name conversation.inbox.name
|
|
|
|
json.channel_type conversation.inbox.channel_type
|
|
|
|
end
|
2020-11-07 20:16:45 +00:00
|
|
|
json.messages do
|
|
|
|
json.array! conversation.messages do |message|
|
|
|
|
json.content message.content
|
2021-03-15 13:08:05 +00:00
|
|
|
json.id message.id
|
|
|
|
json.sender_name message.sender.name if message.sender
|
|
|
|
json.message_type message.message_type_before_type_cast
|
2020-11-07 20:16:45 +00:00
|
|
|
json.created_at message.created_at.to_i
|
|
|
|
end
|
2020-09-23 09:57:41 +00:00
|
|
|
end
|
2020-11-07 20:16:45 +00:00
|
|
|
json.account_id conversation.account_id
|
2020-09-23 09:57:41 +00:00
|
|
|
end
|
|
|
|
end
|