Chore: Scope URLs with account_id (#601)

* Chore: Enable Users to create multiple accounts

Addresses: #402
- migrations to split roles and other attributes from users table
- make changes in code to accommodate this change

Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com>
This commit is contained in:
Sojan Jose
2020-03-09 23:27:10 +05:30
committed by GitHub
parent 2a6670f0da
commit 19ab0fe108
105 changed files with 480 additions and 402 deletions

View File

@@ -0,0 +1,10 @@
json.array! @agents do |agent|
json.account_id agent.account.id
json.availability_status agent.availability_status
json.confirmed agent.confirmed?
json.email agent.email
json.id agent.id
json.name agent.name
json.role agent.role
json.thumbnail agent.avatar_url
end

View File

@@ -0,0 +1,4 @@
json.data do
json.page_details @page_details
json.user_access_token @user_access_token
end

View File

@@ -0,0 +1,5 @@
json.payload do
json.array! @conversations do |conversation|
json.partial! 'api/v1/conversations/partials/conversation.json.jbuilder', conversation: conversation
end
end

View File

@@ -0,0 +1,10 @@
json.payload do
json.array! @contacts do |contact|
json.id contact.id
json.name contact.name
json.email contact.email
json.phone_number contact.phone_number
json.thumbnail contact.avatar_url
json.additional_attributes contact.additional_attributes
end
end

View File

@@ -0,0 +1,9 @@
json.payload do
json.availability_status @contact.availability_status
json.email @contact.email
json.id @contact.id
json.name @contact.name
json.phone_number @contact.phone_number
json.thumbnail @contact.avatar_url
json.additional_attributes @contact.additional_attributes
end

View File

@@ -0,0 +1,8 @@
json.payload do
json.id @contact.id
json.name @contact.name
json.email @contact.email
json.phone_number @contact.phone_number
json.thumbnail @contact.avatar_url
json.additional_attributes @contact.additional_attributes
end

View File

@@ -0,0 +1,4 @@
json.payload do
json.assignee @conversation.assignee
json.conversation_id @conversation.display_id
end

View File

@@ -0,0 +1,12 @@
json.data do
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.partial! 'api/v1/conversations/partials/conversation.json.jbuilder', conversation: conversation
end
end
end

View File

@@ -0,0 +1 @@
json.payload @labels

View File

@@ -0,0 +1 @@
json.payload @labels

View File

@@ -0,0 +1,8 @@
json.id @message.id
json.content @message.content
json.inbox_id @message.inbox_id
json.conversation_id @message.conversation_id
json.message_type @message.message_type_before_type_cast
json.created_at @message.created_at.to_i
json.private @message.private
json.attachment @message.attachment.push_event_data if @message.attachment

View File

@@ -0,0 +1,20 @@
json.meta do
json.labels @conversation.label_list
json.additional_attributes @conversation.additional_attributes
json.contact_id @conversation.contact_id
end
json.payload do
json.array! @messages do |message|
json.id message.id
json.content message.content
json.inbox_id message.inbox_id
json.conversation_id message.conversation.display_id
json.message_type message.message_type_before_type_cast
json.created_at message.created_at.to_i
json.private message.private
json.source_id message.source_id
json.attachment message.attachment.push_event_data if message.attachment
json.sender message.user.push_event_data if message.user
end
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/conversations/partials/conversation.json.jbuilder', conversation: @conversation

View File

@@ -0,0 +1,8 @@
json.meta do
end
json.payload do
json.success @status
json.current_status @conversation.status
json.conversation_id @conversation.display_id
end

View File

@@ -0,0 +1,6 @@
json.payload do
json.array! @agents do |agent|
json.user_id agent.id
json.name agent.name
end
end

View File

@@ -0,0 +1,13 @@
json.payload do
json.array! @inboxes do |inbox|
json.id inbox.id
json.channel_id inbox.channel_id
json.name inbox.name
json.channel_type inbox.channel_type
json.avatar_url inbox.channel.try(:avatar_url)
json.page_id inbox.channel.try(:page_id)
json.widget_color inbox.channel.try(:widget_color)
json.website_token inbox.channel.try(:website_token)
json.enable_auto_assignment inbox.enable_auto_assignment
end
end

View File

@@ -0,0 +1,8 @@
json.data do
json.meta do
end
json.payload do
json.labels @labels
end
end

View File

@@ -0,0 +1,3 @@
json.payload do
json.labels @labels
end

View File

@@ -0,0 +1,5 @@
json.id @notification_setting.id
json.user_id @notification_setting.user_id
json.account_id @notification_setting.account_id
json.all_email_flags @notification_setting.all_email_flags
json.selected_email_flags @notification_setting.selected_email_flags

View File

@@ -0,0 +1,9 @@
json.id webhook.id
json.url webhook.url
json.account_id webhook.account_id
if webhook.inbox
json.inbox do
json.id webhook.inbox.id
json.name webhook.inbox.name
end
end

View File

@@ -0,0 +1,5 @@
json.payload do
json.webhook do
json.partial! 'webhook', webhook: @webhook
end
end

View File

@@ -0,0 +1,5 @@
json.payload do
json.webhooks do
json.array! @webhooks, partial: 'webhook', as: :webhook
end
end

View File

@@ -0,0 +1,5 @@
json.payload do
json.webhook do
json.partial! 'webhook', webhook: @webhook
end
end