feat: include account_id in contact and inbox JSON responses (#182)

* test: include account_id in inbox response validation
This commit is contained in:
Gabriel Jablonski 2026-01-13 00:51:10 -03:00 committed by GitHub
parent 85e8258a87
commit 4db3c7c7ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 1 deletions

View File

@ -10,6 +10,7 @@ json.thumbnail resource.avatar_url
json.custom_attributes resource.custom_attributes
json.last_activity_at resource.last_activity_at.to_i if resource[:last_activity_at].present?
json.created_at resource.created_at.to_i if resource[:created_at].present?
json.account_id resource.account_id
# we only want to output contact inbox when its /contacts endpoints
if defined?(with_contact_inboxes) && with_contact_inboxes.present?
json.contact_inboxes do

View File

@ -3,6 +3,7 @@ json.avatar_url resource.try(:avatar_url)
json.channel_id resource.channel_id
json.name resource.name
json.channel_type resource.channel_type
json.account_id resource.account_id
json.greeting_enabled resource.greeting_enabled
json.greeting_message resource.greeting_message
json.working_hours_enabled resource.working_hours_enabled

View File

@ -3,4 +3,5 @@ json.avatar_url resource.try(:avatar_url)
json.channel_id resource.channel_id
json.name resource.name
json.channel_type resource.channel_type
json.account_id resource.account_id
json.provider resource.channel.try(:provider)

View File

@ -80,7 +80,7 @@ RSpec.describe 'Contacts API', type: :request do
expect(contact_emails).to include(contact.email)
first_inbox = contact_inboxes[0]['inbox']
expect(first_inbox).to be_a(Hash)
expect(first_inbox).to include('id', 'channel_id', 'channel_type', 'name', 'avatar_url', 'provider')
expect(first_inbox).to include('id', 'channel_id', 'channel_type', 'account_id', 'name', 'avatar_url', 'provider')
expect(first_inbox).not_to include('imap_login',
'imap_password',