iachat/app/views/api/v1/models/_conversation.json.jbuilder
Muhsin Keloth 05b8486538
fix: message_type inconsistency across message end points (#10108)
The `before_type_cast` method sometimes returns a string for
`message_type`, creating inconsistencies in different payloads. This
pull request will remove all `before_type_cast` usage and replace it
with `to_i` methods.
2024-09-16 16:14:35 +05:30

25 lines
728 B
Ruby

# This file is used to render conversation data search API response.
json.id conversation.display_id
json.uuid conversation.uuid
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
json.messages do
json.array! conversation.messages do |message|
json.content message.content
json.id message.id
json.sender_name message.sender.name if message.sender
json.message_type message.message_type.to_i
json.created_at message.created_at.to_i
end
end
json.account_id conversation.account_id