18F/micropurchase

View on GitHub
config/routes.rb

Summary

Maintainability
A
0 mins
Test Coverage
Rails.application.routes.draw do
  if Rails.env.development?
    mount LetterOpenerWeb::Engine => "letter_opener"
  end

  root 'auctions#index'

  get '/auth/github/callback', to: 'authentications#create'
  get '/logout', to: 'authentications#destroy'

  match 'auth/saml/callback', to: 'saml_authentications#create', via: [:get, :post]
  match 'auth/saml/logout', to: 'saml_authentications#destroy', via: [:get, :post, :delete]
  match 'auth/saml/setup', to: 'saml_authentications#setup', via: [:get, :post]

  get '/auctions/rules/sealed-bid', to: 'auctions#sealed_bid_auction_rules'
  get '/auctions/rules/reverse', to: 'auctions#reverse_auction_rules'
  get '/admin', to: 'admin/auctions/needs_attention#index'
  get '/admin/sign_in', to: 'admin/sign_ins#show'
  get '/sign_up', to: 'sign_ups#show'
  get '/sign_in', to: 'sign_ins#show'

  get '/api' => 'docs#index', as: 'api_doc'

  namespace :admin do
    resources :auction_reports, only: [:show]
    resources :auction_rejections, only: [:update]
    resources :auction_acceptances, only: [:update]
    resources :auction_mark_payments, only: [:update]
    resources :missed_deliveries, only: [:update]
    resources :user_reports, only: [:index]
    resources :proposals, only: [:create]
    resources :users, only: [:show, :edit, :update]

    namespace :auctions do
      get '/closed', to: 'closed#index'
      get '/needs_attention', to: 'needs_attention#index'
    end

    resources :auctions, except: [:index]

    scope '/people' do
      resources :admins, only: [:index]
      resources :vendors, only: [:index]
      resources :vendors, only: [:show] do
        resources :masquerades, only: [:new, :destroy]
      end
    end

    scope '/settings' do
      resources :customers, only: [:index, :new, :create, :edit, :update]
      resources :skills, only: [:index, :new, :create, :edit, :update]
    end
  end

  resources :auctions, only: [:index, :update]

  resources :auctions, only: [:show] do
    resources :bids, only: [:create]
    resources :receipts, only: [:new, :create]

    get 'receipt', to: 'receipts#show'
  end

  resources :users, only: [:update]
  get 'account/profile', to: 'users#edit', as: 'profile'
  get 'account/bids', to: 'bids#index', as: 'bids_placed'

  resources :insights, only: [:index]

  # Map current API requests to new controller for now
  namespace :api, defaults: { format: 'json' } do
    namespace :v0 do
      resources :auctions, only: [:index, :show] do
        resources :bids, only: [:create]
      end

      namespace :admin do
        resources :auctions, only: [:index, :show]
        resources :users, only: [:index]
      end

      get 'business_day', to: 'business_days#show'
    end
  end
end