BigW Consortium Gitlab

routes.rb 2.1 KB
Newer Older
Dmitriy Zaporozhets committed
1
require 'sidekiq/web'
2
require 'sidekiq/cron/web'
3
require 'api/api'
Dmitriy Zaporozhets committed
4

5 6 7 8 9 10
class ActionDispatch::Routing::Mapper
  def draw(routes_name)
    instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
  end
end

Valery Sizov committed
11
Rails.application.routes.draw do
12 13
  concern :access_requestable do
    post :request_access, on: :collection
14
    post :approve_access_request, on: :member
15 16
  end

17 18 19 20
  concern :awardable do
    post :toggle_award_emoji, on: :member
  end

21 22 23
  draw :sherlock
  draw :development
  draw :ci
24

Valery Sizov committed
25
  use_doorkeeper do
26 27 28
    controllers applications: 'oauth/applications',
                authorized_applications: 'oauth/authorized_applications',
                authorizations: 'oauth/authorizations'
Valery Sizov committed
29
  end
30

31 32 33
  # Autocomplete
  get '/autocomplete/users' => 'autocomplete#users'
  get '/autocomplete/users/:id' => 'autocomplete#user'
34
  get '/autocomplete/projects' => 'autocomplete#projects'
35

36 37
  # Emojis
  resources :emojis, only: :index
38

39
  # Search
40 41
  get 'search' => 'search#show'
  get 'search/autocomplete' => 'search#autocomplete', as: :search_autocomplete
Valery Sizov committed
42

Kamil Trzcinski committed
43 44 45
  # JSON Web Token
  get 'jwt/auth' => 'jwt#auth'

46
  # Health check
47
  get 'health_check(/:checks)' => 'health_check#index', as: :health_check
48

49 50 51
  # Koding route
  get 'koding' => 'koding#index'

52 53 54 55
  draw :api
  draw :sidekiq
  draw :help
  draw :snippets
Andrew8xx8 committed
56

Douwe Maan committed
57 58 59 60
  # Invites
  resources :invites, only: [:show], constraints: { id: /[A-Za-z0-9_-]+/ } do
    member do
      post :accept
Douwe Maan committed
61
      match :decline, via: [:get, :post]
Douwe Maan committed
62 63
    end
  end
64

65
  resources :sent_notifications, only: [], constraints: { id: /\h{32}/ } do
66 67 68 69 70
    member do
      get :unsubscribe
    end
  end

71 72 73
  # Spam reports
  resources :abuse_reports, only: [:new, :create]

74 75 76
  # Notification settings
  resources :notification_settings, only: [:create, :update]

77 78 79 80 81 82 83 84 85
  draw :import
  draw :uploads
  draw :explore
  draw :admin
  draw :profile
  draw :dashboard
  draw :group
  draw :user
  draw :project
gitlabhq committed
86

87 88 89
  # Get all keys of user
  get ':username.keys' => 'profiles/keys#get_keys', constraints: { username: /.*/ }

90 91
  get ':id' => 'namespaces#show', constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ }

92
  root to: "root#index"
gitlabhq committed
93
end