BigW Consortium Gitlab

routes.rb 2.29 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
  use_doorkeeper_openid_connect

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

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

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

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

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

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

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

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

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

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

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

80
  root to: "root#index"
81

82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
  # 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
97
end