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:
158
config/routes.rb
158
config/routes.rb
@@ -19,93 +19,97 @@ Rails.application.routes.draw do
|
||||
|
||||
namespace :api, defaults: { format: 'json' } do
|
||||
namespace :v1 do
|
||||
resources :callbacks, only: [] do
|
||||
collection do
|
||||
post :register_facebook_page
|
||||
get :register_facebook_page
|
||||
post :get_facebook_pages
|
||||
post :reauthorize_page
|
||||
# ----------------------------------
|
||||
# start of account scoped api routes
|
||||
resources :accounts, only: [:create], module: :accounts do
|
||||
namespace :actions do
|
||||
resource :contact_merge, only: [:create]
|
||||
end
|
||||
|
||||
resources :agents, except: [:show, :edit, :new]
|
||||
resources :callbacks, only: [] do
|
||||
collection do
|
||||
post :register_facebook_page
|
||||
get :register_facebook_page
|
||||
post :facebook_pages
|
||||
post :reauthorize_page
|
||||
end
|
||||
end
|
||||
resources :canned_responses, except: [:show, :edit, :new]
|
||||
|
||||
resources :conversations, only: [:index, :show] do
|
||||
scope module: :conversations do
|
||||
resources :messages, only: [:index, :create]
|
||||
resources :assignments, only: [:create]
|
||||
resources :labels, only: [:create, :index]
|
||||
end
|
||||
member do
|
||||
post :toggle_status
|
||||
post :update_last_seen
|
||||
end
|
||||
end
|
||||
|
||||
resources :contacts, only: [:index, :show, :update, :create] do
|
||||
scope module: :contacts do
|
||||
resources :conversations, only: [:index]
|
||||
end
|
||||
end
|
||||
|
||||
resources :facebook_indicators, only: [] do
|
||||
collection do
|
||||
post :mark_seen
|
||||
post :typing_on
|
||||
post :typing_off
|
||||
end
|
||||
end
|
||||
|
||||
resources :inboxes, only: [:index, :destroy, :update]
|
||||
resources :inbox_members, only: [:create, :show], param: :inbox_id
|
||||
resources :labels, only: [:index] do
|
||||
collection do
|
||||
get :most_used
|
||||
end
|
||||
end
|
||||
|
||||
resource :notification_settings, only: [:show, :update]
|
||||
|
||||
resources :reports, only: [] do
|
||||
collection do
|
||||
get :account
|
||||
get :agent
|
||||
end
|
||||
member do
|
||||
get :account_summary
|
||||
get :agent_summary
|
||||
end
|
||||
end
|
||||
|
||||
# this block is only required if subscription via chargebee is enabled
|
||||
resources :subscriptions, only: [:index] do
|
||||
collection do
|
||||
get :summary
|
||||
end
|
||||
end
|
||||
|
||||
resources :webhooks, except: [:show]
|
||||
end
|
||||
|
||||
# end of account scoped api routes
|
||||
# ----------------------------------
|
||||
|
||||
resource :profile, only: [:show, :update]
|
||||
|
||||
namespace :widget do
|
||||
resources :messages, only: [:index, :create, :update]
|
||||
resources :inboxes, only: [:create, :update]
|
||||
resources :inbox_members, only: [:index]
|
||||
end
|
||||
|
||||
namespace :actions do
|
||||
resource :contact_merge, only: [:create]
|
||||
end
|
||||
|
||||
namespace :account do
|
||||
resources :webhooks, except: [:show]
|
||||
end
|
||||
|
||||
resource :profile, only: [:show, :update]
|
||||
resources :accounts, only: [:create]
|
||||
resources :inboxes, only: [:index, :destroy, :update]
|
||||
resources :agents, except: [:show, :edit, :new]
|
||||
resources :labels, only: [:index] do
|
||||
collection do
|
||||
get :most_used
|
||||
end
|
||||
end
|
||||
resources :canned_responses, except: [:show, :edit, :new]
|
||||
resources :inbox_members, only: [:create, :show], param: :inbox_id
|
||||
resources :facebook_indicators, only: [] do
|
||||
collection do
|
||||
post :mark_seen
|
||||
post :typing_on
|
||||
post :typing_off
|
||||
end
|
||||
end
|
||||
|
||||
resources :reports, only: [] do
|
||||
collection do
|
||||
get :account
|
||||
get :agent
|
||||
end
|
||||
member do
|
||||
get :account_summary
|
||||
get :agent_summary
|
||||
end
|
||||
end
|
||||
|
||||
resources :conversations, only: [:index, :show] do
|
||||
scope module: :conversations do
|
||||
resources :messages, only: [:index, :create]
|
||||
resources :assignments, only: [:create]
|
||||
resources :labels, only: [:create, :index]
|
||||
end
|
||||
member do
|
||||
post :toggle_status
|
||||
post :update_last_seen
|
||||
end
|
||||
end
|
||||
|
||||
resources :contacts, only: [:index, :show, :update, :create] do
|
||||
scope module: :contacts do
|
||||
resources :conversations, only: [:index]
|
||||
end
|
||||
end
|
||||
|
||||
# this block is only required if subscription via chargebee is enabled
|
||||
resources :subscriptions, only: [:index] do
|
||||
collection do
|
||||
get :summary
|
||||
end
|
||||
end
|
||||
|
||||
resources :webhooks, only: [] do
|
||||
collection do
|
||||
post :chargebee
|
||||
end
|
||||
end
|
||||
|
||||
namespace :user do
|
||||
resource :notification_settings, only: [:show, :update]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -114,17 +118,19 @@ Rails.application.routes.draw do
|
||||
resource :callback, only: [:show]
|
||||
end
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Used in mailer templates
|
||||
resource :app, only: [:index] do
|
||||
resources :conversations, only: [:show]
|
||||
end
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Routes for social integrations
|
||||
mount Facebook::Messenger::Server, at: 'bot'
|
||||
get 'webhooks/twitter', to: 'api/v1/webhooks#twitter_crc'
|
||||
post 'webhooks/twitter', to: 'api/v1/webhooks#twitter_events'
|
||||
|
||||
post '/webhooks/telegram/:account_id/:inbox_id' => 'home#telegram'
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Routes for testing
|
||||
resources :widget_tests, only: [:index] unless Rails.env.production?
|
||||
|
||||
@@ -147,8 +153,8 @@ Rails.application.routes.draw do
|
||||
|
||||
mount Sidekiq::Web, at: '/sidekiq'
|
||||
end
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Routes for swagger docs
|
||||
get '/swagger/*path', to: 'swagger#respond'
|
||||
get '/swagger', to: 'swagger#respond'
|
||||
|
||||
Reference in New Issue
Block a user