BigW Consortium Gitlab

routes.rb 2.3 KB
Newer Older
Dmitriy Zaporozhets committed
1
require 'sidekiq/web'
2
require 'sidekiq/cron/web'
3
require 'constraints/group_url_constrainer'
Dmitriy Zaporozhets committed
4

Valery Sizov committed
5
Rails.application.routes.draw do
6 7
  concern :access_requestable do
    post :request_access, on: :collection
8
    post :approve_access_request, on: :member
9 10
  end

11 12 13 14
  concern :awardable do
    post :toggle_award_emoji, on: :member
  end

15 16 17
  draw :sherlock
  draw :development
  draw :ci
18

Valery Sizov committed
19
  use_doorkeeper do
20 21 22
    controllers applications: 'oauth/applications',
                authorized_applications: 'oauth/authorized_applications',
                authorizations: 'oauth/authorizations'
Valery Sizov committed
23
  end
24

25 26 27
  # Autocomplete
  get '/autocomplete/users' => 'autocomplete#users'
  get '/autocomplete/users/:id' => 'autocomplete#user'
28
  get '/autocomplete/projects' => 'autocomplete#projects'
29

30 31
  # Emojis
  resources :emojis, only: :index
32

33
  # Search
34 35
  get 'search' => 'search#show'
  get 'search/autocomplete' => 'search#autocomplete', as: :search_autocomplete
Valery Sizov committed
36

Kamil Trzcinski committed
37 38 39
  # JSON Web Token
  get 'jwt/auth' => 'jwt#auth'

40
  # Health check
41
  get 'health_check(/:checks)' => 'health_check#index', as: :health_check
42

43 44 45
  # Koding route
  get 'koding' => 'koding#index'

46 47 48 49
  draw :api
  draw :sidekiq
  draw :help
  draw :snippets
Andrew8xx8 committed
50

Douwe Maan committed
51 52 53 54
  # Invites
  resources :invites, only: [:show], constraints: { id: /[A-Za-z0-9_-]+/ } do
    member do
      post :accept
Douwe Maan committed
55
      match :decline, via: [:get, :post]
Douwe Maan committed
56 57
    end
  end
58

59
  resources :sent_notifications, only: [], constraints: { id: /\h{32}/ } do
60 61 62 63 64
    member do
      get :unsubscribe
    end
  end

65 66 67
  # Spam reports
  resources :abuse_reports, only: [:new, :create]

68 69 70
  # Notification settings
  resources :notification_settings, only: [:create, :update]

71 72 73 74 75 76 77 78 79
  draw :import
  draw :uploads
  draw :explore
  draw :admin
  draw :profile
  draw :dashboard
  draw :group
  draw :user
  draw :project
gitlabhq committed
80

81
  root to: "root#index"
82

83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
  # Since group show page is wildcard routing
  # we want all other routing to be checked before matching this one
  constraints(GroupUrlConstrainer.new) do
    scope(path: '*id',
          as: :group,
          constraints: { id: Gitlab::Regex.namespace_route_regex, format: /(html|json|atom)/ },
          controller: :groups) do
      get '/', action: :show
      patch '/', action: :update
      put '/', action: :update
      delete '/', action: :destroy
    end
  end

  get '*unmatched_route', to: 'application#route_not_found'
gitlabhq committed
98
end