routes.rb 17.8 KB
Newer Older
Dmitriy Zaporozhets's avatar
sidekiq    
Dmitriy Zaporozhets committed
1
require 'sidekiq/web'
2
require 'api/api'
Dmitriy Zaporozhets's avatar
sidekiq    
Dmitriy Zaporozhets committed
3

gitlabhq's avatar
gitlabhq committed
4
Gitlab::Application.routes.draw do
Douwe Maan's avatar
Douwe Maan committed
5
6
7
8
9
10
11
12
13
14
  namespace :ci do
    # CI API
    Ci::API::API.logger Rails.logger
    mount Ci::API::API => '/api'

    resource :lint, only: [:show, :create]

    resources :projects do
      collection do
        post :add
Kamil Trzcinski's avatar
Kamil Trzcinski committed
15
        get :disabled
Douwe Maan's avatar
Douwe Maan committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
      end

      member do
        get :status, to: 'projects#badge'
        get :integration
        post :toggle_shared_runners
        get :dumped_yaml
      end

      resources :runner_projects, only: [:create, :destroy]
    end

    resource :user_sessions do
      get :auth
      get :callback
    end

    namespace :admin do
      resources :runners, only: [:index, :show, :update, :destroy] do
        member do
          put :assign_all
          get :resume
          get :pause
        end
      end

      resources :events, only: [:index]

      resources :projects do
        resources :runner_projects
      end

      resources :builds, only: :index

      resource :application_settings, only: [:show, :update]
    end

    root to: 'projects#index'
  end

Valery Sizov's avatar
Valery Sizov committed
56
  use_doorkeeper do
57
58
59
    controllers applications: 'oauth/applications',
                authorized_applications: 'oauth/authorized_applications',
                authorizations: 'oauth/authorizations'
Valery Sizov's avatar
Valery Sizov committed
60
  end
61

62
63
64
65
66
  # Autocomplete
  get '/autocomplete/users' => 'autocomplete#users'
  get '/autocomplete/users/:id' => 'autocomplete#user'


67
  # Search
68
69
  get 'search' => 'search#show'
  get 'search/autocomplete' => 'search#autocomplete', as: :search_autocomplete
Valery Sizov's avatar
Valery Sizov committed
70

71
  # API
72
73
  API::API.logger Rails.logger
  mount API::API => '/api'
74

GitLab's avatar
GitLab committed
75
  # Get all keys of user
76
77
  get ':username.keys' => 'profiles/keys#get_keys' , constraints: { username: /.*/ }

78
  constraint = lambda { |request| request.env['warden'].authenticate? and request.env['warden'].user.admin? }
Dmitriy Zaporozhets's avatar
sidekiq    
Dmitriy Zaporozhets committed
79
  constraints constraint do
80
    mount Sidekiq::Web, at: '/admin/sidekiq', as: :sidekiq
Dmitriy Zaporozhets's avatar
sidekiq    
Dmitriy Zaporozhets committed
81
  end
Ariejan de Vroom's avatar
Ariejan de Vroom committed
82

83
  # Enable Grack support
84
  mount Grack::AuthSpawner, at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }, via: [:get, :post]
85

86
  # Help
Job van der Voort's avatar
Job van der Voort committed
87
  get 'help'                  => 'help#index'
88
  get 'help/:category/:file'  => 'help#show', as: :help_page, constraints: { category: /.*/, file: /[^\/\.]+/ }
Marin Jankovski's avatar
Marin Jankovski committed
89
  get 'help/shortcuts'
90
  get 'help/ui'               => 'help#ui'
91

Andrew8xx8's avatar
Andrew8xx8 committed
92
93
94
95
96
  #
  # Global snippets
  #
  resources :snippets do
    member do
97
      get 'raw'
Andrew8xx8's avatar
Andrew8xx8 committed
98
99
    end
  end
100
101

  get '/s/:username' => 'snippets#index', as: :user_snippets, constraints: { username: /.*/ }
Andrew8xx8's avatar
Andrew8xx8 committed
102

Douwe Maan's avatar
Douwe Maan committed
103
104
105
106
107
108
109
  #
  # Invites
  #

  resources :invites, only: [:show], constraints: { id: /[A-Za-z0-9_-]+/ } do
    member do
      post :accept
Douwe Maan's avatar
Douwe Maan committed
110
      match :decline, via: [:get, :post]
Douwe Maan's avatar
Douwe Maan committed
111
112
    end
  end
113

114
115
116
  # Spam reports
  resources :abuse_reports, only: [:new, :create]

Valery Sizov's avatar
Valery Sizov committed
117
  #
118
  # Import
Valery Sizov's avatar
Valery Sizov committed
119
  #
120
121
  namespace :import do
    resource :github, only: [:create, :new], controller: :github do
Valery Sizov's avatar
Valery Sizov committed
122
123
124
125
126
      get :status
      get :callback
      get :jobs
    end

127
    resource :gitlab, only: [:create, :new], controller: :gitlab do
Valery Sizov's avatar
Valery Sizov committed
128
129
130
131
      get :status
      get :callback
      get :jobs
    end
Marcin Kulik's avatar
Marcin Kulik committed
132

Douwe Maan's avatar
Douwe Maan committed
133
134
135
136
137
    resource :bitbucket, only: [:create, :new], controller: :bitbucket do
      get :status
      get :callback
      get :jobs
    end
138

Marcin Kulik's avatar
Marcin Kulik committed
139
140
141
142
143
    resource :gitorious, only: [:create, :new], controller: :gitorious do
      get :status
      get :callback
      get :jobs
    end
144
145
146
147
148

    resource :google_code, only: [:create, :new], controller: :google_code do
      get :status
      post :callback
      get :jobs
Douwe Maan's avatar
Douwe Maan committed
149
150
151

      get   :new_user_map,    path: :user_map
      post  :create_user_map, path: :user_map
152
    end
Jared Szechy's avatar
Jared Szechy committed
153
154
155
156
157
158
159
160
161

    resource :fogbugz, only: [:create, :new], controller: :fogbugz do
      get :status
      post :callback
      get :jobs

      get   :new_user_map,    path: :user_map
      post  :create_user_map, path: :user_map
    end
Valery Sizov's avatar
Valery Sizov committed
162
  end
163

164
165
166
  #
  # Uploads
  #
167

168
169
  scope path: :uploads do
    # Note attachments and User/Group/Project avatars
170
171
    get ":model/:mounted_as/:id/:filename",
        to:           "uploads#show",
172
        constraints:  { model: /note|user|group|project/, mounted_as: /avatar|attachment/, filename: /[^\/]+/ }
173
174

    # Project markdown uploads
175
    get ":namespace_id/:project_id/:secret/:filename",
176
      to:           "projects/uploads#show",
177
      constraints:  { namespace_id: /[a-zA-Z.0-9_\-]+/, project_id: /[a-zA-Z.0-9_\-]+/, filename: /[^\/]+/ }
178
  end
Valery Sizov's avatar
Valery Sizov committed
179

180
  # Redirect old note attachments path to new uploads path.
181
182
  get "files/note/:id/:filename",
    to:           redirect("uploads/note/attachment/%{id}/%{filename}"),
183
    constraints:  { filename: /[^\/]+/ }
184

185
  #
Yatish Mehta's avatar
Yatish Mehta committed
186
  # Explore area
187
  #
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
188
189
190
191
  namespace :explore do
    resources :projects, only: [:index] do
      collection do
        get :trending
192
        get :starred
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
193
194
195
      end
    end

196
    resources :groups, only: [:index]
197
    resources :snippets, only: [:index]
198
    root to: 'projects#trending'
199
200
  end

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
201
  # Compatibility with old routing
202
203
  get 'public' => 'explore/projects#index'
  get 'public/projects' => 'explore/projects#index'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
204

205
206
207
  #
  # Admin Area
  #
Nihad Abbasov's avatar
Nihad Abbasov committed
208
  namespace :admin do
209
    resources :users, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
210
      resources :keys, only: [:show, :destroy]
211
      resources :identities, only: [:index, :edit, :update, :destroy]
212

213
      member do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
214
215
216
        get :projects
        get :keys
        get :groups
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
217
        put :team_update
218
219
        put :block
        put :unblock
220
        put :unlock
221
        put :confirm
222
        post :login_as
223
        patch :disable_two_factor
224
        delete 'remove/:email_id', action: 'remove_email', as: 'remove_email'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
225
226
      end
    end
Andrey Kumanyaev's avatar
Andrey Kumanyaev committed
227

228
    resources :abuse_reports, only: [:index, :destroy]
Valery Sizov's avatar
Valery Sizov committed
229
230
    resources :applications

231
232
    resources :groups, constraints: { id: /[^\/]+/ } do
      member do
233
        put :members_update
234
      end
Andrey Kumanyaev's avatar
Andrey Kumanyaev committed
235
    end
Andrey Kumanyaev's avatar
Andrey Kumanyaev committed
236

237
    resources :deploy_keys, only: [:index, :new, :create, :destroy]
238

Robert Speicher's avatar
Robert Speicher committed
239
    resources :hooks, only: [:index, :create, :destroy] do
Valeriy Sizov's avatar
Valeriy Sizov committed
240
241
      get :test
    end
Andrey Kumanyaev's avatar
Andrey Kumanyaev committed
242

243
    resources :broadcast_messages, only: [:index, :create, :destroy]
244
    resource :logs, only: [:show]
245
    resource :background_jobs, controller: 'background_jobs', only: [:show]
246

Vinnie Okada's avatar
Vinnie Okada committed
247
248
249
    resources :namespaces, path: '/projects', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: [] do
      root to: 'projects#index', as: :projects

250
251
      resources(:projects,
                path: '/',
Vinnie Okada's avatar
Vinnie Okada committed
252
253
254
255
256
257
258
                constraints: { id: /[a-zA-Z.0-9_\-]+/ },
                only: [:index, :show]) do
        root to: 'projects#show'

        member do
          put :transfer
        end
259
260
261
      end
    end

262
263
264
    resource :application_settings, only: [:show, :update] do
      resources :services
    end
265

Valery Sizov's avatar
Valery Sizov committed
266
267
    resources :labels

268
    root to: 'dashboard#index'
gitlabhq's avatar
gitlabhq committed
269
270
  end

randx's avatar
randx committed
271
272
273
  #
  # Profile Area
  #
274
275
  resource :profile, only: [:show, :update] do
    member do
276
      get :audit_log
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
277
      get :applications
278
279
280
281

      put :reset_private_token
      put :update_username
    end
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
282

283
    scope module: :profiles do
284
285
286
287
288
      resource :account, only: [:show, :update] do
        member do
          delete :unlink
        end
      end
289
      resource :notifications, only: [:show, :update]
290
291
292
293
294
      resource :password, only: [:new, :create, :edit, :update] do
        member do
          put :reset
        end
      end
295
      resource :preferences, only: [:show, :update]
296
      resources :keys
297
      resources :emails, only: [:index, :create, :destroy]
298
      resource :avatar, only: [:destroy]
299
300
      resource :two_factor_auth, only: [:new, :create, :destroy] do
        member do
301
          post :codes
302
303
        end
      end
304
    end
305
  end
Robert Speicher's avatar
Robert Speicher committed
306

307
  get 'u/:username/calendar' => 'users#calendar', as: :user_calendar,
308
309
310
311
      constraints: { username: /.*/ }

  get 'u/:username/calendar_activities' => 'users#calendar_activities', as: :user_calendar_activities,
      constraints: { username: /.*/ }
312

313
  get '/u/:username' => 'users#show', as: :user,
314
      constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
315

randx's avatar
randx committed
316
317
318
  #
  # Dashboard Area
  #
319
320
321
322
  resource :dashboard, controller: 'dashboard', only: [] do
    get :issues
    get :merge_requests
    get :activity
Douwe Maan's avatar
Douwe Maan committed
323
324
325

    scope module: :dashboard do
      resources :milestones, only: [:index, :show]
326

327
      resources :groups, only: [:index]
328
      resources :snippets, only: [:index]
329

330
      resources :projects, only: [:index] do
331
332
333
334
        collection do
          get :starred
        end
      end
Douwe Maan's avatar
Douwe Maan committed
335
    end
336
337

    root to: "dashboard/projects#index"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
338
  end
gitlabhq's avatar
gitlabhq committed
339

randx's avatar
randx committed
340
341
342
  #
  # Groups Area
  #
343
  resources :groups, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }  do
randx's avatar
randx committed
344
345
346
    member do
      get :issues
      get :merge_requests
347
      get :projects
randx's avatar
randx committed
348
    end
349

Steven Thonus's avatar
Steven Thonus committed
350
    scope module: :groups do
351
      resources :group_members, only: [:index, :create, :update, :destroy] do
352
        post :resend_invite, on: :member
353
        delete :leave, on: :collection
354
      end
355

Steven Thonus's avatar
Steven Thonus committed
356
      resource :avatar, only: [:destroy]
Douwe Maan's avatar
Douwe Maan committed
357
      resources :milestones, only: [:index, :show, :update]
Steven Thonus's avatar
Steven Thonus committed
358
    end
randx's avatar
randx committed
359
360
  end

361
  resources :projects, constraints: { id: /[^\/]+/ }, only: [:index, :new, :create]
362

363
  devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations , passwords: :passwords, sessions: :sessions, confirmations: :confirmations }
gitlabhq's avatar
gitlabhq committed
364

365
  devise_scope :user do
366
    get '/users/auth/:provider/omniauth_error' => 'omniauth_callbacks#omniauth_error', as: :omniauth_error
367
  end
Vinnie Okada's avatar
Vinnie Okada committed
368

369
  root to: "root#index"
Vinnie Okada's avatar
Vinnie Okada committed
370

371
372
373
  #
  # Project Area
  #
Vinnie Okada's avatar
Vinnie Okada committed
374
  resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: [] do
375
    resources(:projects, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }, except:
Vinnie Okada's avatar
Vinnie Okada committed
376
377
378
              [:new, :create, :index], path: "/") do
      member do
        put :transfer
379
        delete :remove_fork
Vinnie Okada's avatar
Vinnie Okada committed
380
381
382
383
384
        post :archive
        post :unarchive
        post :toggle_star
        post :markdown_preview
        get :autocomplete_sources
385
        get :activity
skv's avatar
skv committed
386
      end
387

Vinnie Okada's avatar
Vinnie Okada committed
388
389
390
391
392
393
394
395
396
      scope module: :projects do
        # Blob routes:
        get '/new/*id', to: 'blob#new', constraints: { id: /.+/ }, as: 'new_blob'
        post '/create/*id', to: 'blob#create', constraints: { id: /.+/ }, as: 'create_blob'
        get '/edit/*id', to: 'blob#edit', constraints: { id: /.+/ }, as: 'edit_blob'
        put '/update/*id', to: 'blob#update', constraints: { id: /.+/ }, as: 'update_blob'
        post '/preview/*id', to: 'blob#preview', constraints: { id: /.+/ }, as: 'preview_blob'

        scope do
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
          get(
            '/blob/*id/diff',
            to: 'blob#diff',
            constraints: { id: /.+/, format: false },
            as: :blob_diff
          )
          get(
            '/blob/*id',
            to: 'blob#show',
            constraints: { id: /.+/, format: false },
            as: :blob
          )
          delete(
            '/blob/*id',
            to: 'blob#destroy',
            constraints: { id: /.+/, format: false }
          )
414
415
416
417
418
419
420
421
422
423
          put(
            '/blob/*id',
            to: 'blob#update',
            constraints: { id: /.+/, format: false }
          )
          post(
            '/blob/*id',
            to: 'blob#create',
            constraints: { id: /.+/, format: false }
          )
Vinnie Okada's avatar
Vinnie Okada committed
424
        end
425

Vinnie Okada's avatar
Vinnie Okada committed
426
427
428
429
430
431
432
        scope do
          get(
            '/raw/*id',
            to: 'raw#show',
            constraints: { id: /.+/, format: /(html|js)/ },
            as: :raw
          )
433
        end
434

Vinnie Okada's avatar
Vinnie Okada committed
435
436
437
438
439
440
441
442
443
        scope do
          get(
            '/tree/*id',
            to: 'tree#show',
            constraints: { id: /.+/, format: /(html|js)/ },
            as: :tree
          )
        end

Stan Hu's avatar
Stan Hu committed
444
445
446
447
448
449
450
451
452
        scope do
          post(
              '/create_dir/*id',
              to: 'tree#create_dir',
              constraints: { id: /.+/ },
              as: 'create_dir'
          )
        end

Vinnie Okada's avatar
Vinnie Okada committed
453
454
455
456
457
458
459
        scope do
          get(
            '/blame/*id',
            to: 'blame#show',
            constraints: { id: /.+/, format: /(html|js)/ },
            as: :blame
          )
460
        end
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
461

462
463
464
465
        scope do
          get(
            '/commits/*id',
            to: 'commits#show',
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
466
            constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ },
467
468
469
470
471
472
            as: :commits
          )
        end

        resource  :avatar, only: [:show, :destroy]
        resources :commit, only: [:show], constraints: { id: /[[:alnum:]]{6,40}/ } do
473
474
475
          member do
            get :branches
            get :ci
476
            get :cancel_builds
477
          end
478
479
480
481
482
483
        end

        resources :compare, only: [:index, :create]
        resources :network, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ }

        resources :graphs, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ } do
Vinnie Okada's avatar
Vinnie Okada committed
484
485
          member do
            get :commits
486
            get :ci
Vinnie Okada's avatar
Vinnie Okada committed
487
          end
488
        end
Valery Sizov's avatar
Valery Sizov committed
489

Vinnie Okada's avatar
Vinnie Okada committed
490
491
        get '/compare/:from...:to' => 'compare#show', :as => 'compare',
            :constraints => { from: /.+/, to: /.+/ }
492

Vinnie Okada's avatar
Vinnie Okada committed
493
494
495
496
        resources :snippets, constraints: { id: /\d+/ } do
          member do
            get 'raw'
          end
497
        end
498

Stan Hu's avatar
Stan Hu committed
499
        WIKI_SLUG_ID = { id: /[a-zA-Z.0-9_\-\/]+/ } unless defined? WIKI_SLUG_ID
500

Stan Hu's avatar
Stan Hu committed
501
502
503
504
505
506
507
508
509
510
511
512
        scope do
          # Order matters to give priority to these matches
          get '/wikis/git_access', to: 'wikis#git_access'
          get '/wikis/pages', to: 'wikis#pages', as: 'wiki_pages'
          post '/wikis', to: 'wikis#create'

          get '/wikis/*id/history', to: 'wikis#history', as: 'wiki_history', constraints: WIKI_SLUG_ID
          get '/wikis/*id/edit', to: 'wikis#edit', as: 'wiki_edit', constraints: WIKI_SLUG_ID

          get '/wikis/*id', to: 'wikis#show', as: 'wiki', constraints: WIKI_SLUG_ID
          delete '/wikis/*id', to: 'wikis#destroy', constraints: WIKI_SLUG_ID
          put '/wikis/*id', to: 'wikis#update', constraints: WIKI_SLUG_ID
513
        end
514

Vinnie Okada's avatar
Vinnie Okada committed
515
516
517
518
519
        resource :repository, only: [:show, :create] do
          member do
            get 'archive', constraints: { format: Gitlab::Regex.archive_formats_regex }
          end
        end
miks's avatar
miks committed
520

Vinnie Okada's avatar
Vinnie Okada committed
521
522
523
524
        resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do
          member do
            get :test
          end
525
        end
gitlabhq's avatar
gitlabhq committed
526

527
        resources :deploy_keys, constraints: { id: /\d+/ }, only: [:index, :new, :create] do
Vinnie Okada's avatar
Vinnie Okada committed
528
529
530
531
          member do
            put :enable
            put :disable
          end
532
        end
gitlabhq's avatar
gitlabhq committed
533

Vinnie Okada's avatar
Vinnie Okada committed
534
535
536
537
538
539
540
541
542
543
544
        resource :fork, only: [:new, :create]
        resource :import, only: [:new, :create, :show]

        resources :refs, only: [] do
          collection do
            get 'switch'
          end

          member do
            # tree viewer logs
            get 'logs_tree', constraints: { id: Gitlab::Regex.git_reference_regex }
545
546
            # Directories with leading dots erroneously get rejected if git
            # ref regex used in constraints. Regex verification now done in controller.
547
            get 'logs_tree/*path' => 'refs#logs_tree', as: :logs_file, constraints: {
548
              id: /.*/,
Vinnie Okada's avatar
Vinnie Okada committed
549
550
551
              path: /.*/
            }
          end
552
        end
553

Vinnie Okada's avatar
Vinnie Okada committed
554
555
556
        resources :merge_requests, constraints: { id: /\d+/ }, except: [:destroy] do
          member do
            get :diffs
557
            get :commits
558
559
            post :merge
            get :merge_check
Vinnie Okada's avatar
Vinnie Okada committed
560
            get :ci_status
Valery Sizov's avatar
tests    
Valery Sizov committed
561
            post :toggle_subscription
Vinnie Okada's avatar
Vinnie Okada committed
562
563
564
565
566
567
568
          end

          collection do
            get :branch_from
            get :branch_to
            get :update_branches
          end
569
        end
570

Vinnie Okada's avatar
Vinnie Okada committed
571
        resources :branches, only: [:index, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
572
573
574
575
        resources :tags, only: [:index, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } do
          resource :release
        end

Vinnie Okada's avatar
Vinnie Okada committed
576
        resources :protected_branches, only: [:index, :create, :update, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
577
        resource :variables, only: [:show, :update]
578
        resources :triggers, only: [:index, :create, :destroy]
579
        resource :ci_settings, only: [:edit, :update, :destroy]
580
581
582
583
584
        resources :ci_web_hooks, only: [:index, :create, :destroy] do
          member do
            get :test
          end
        end
Vinnie Okada's avatar
Vinnie Okada committed
585

586
587
588
589
590
591
        resources :ci_services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do
          member do
            get :test
          end
        end

Kamil Trzcinski's avatar
Kamil Trzcinski committed
592
593
        resources :builds, only: [:index, :show] do
          collection do
Kamil Trzcinski's avatar
Kamil Trzcinski committed
594
            get :cancel_all
Kamil Trzcinski's avatar
Kamil Trzcinski committed
595
596
          end

597
598
599
600
601
602
          member do
            get :cancel
            get :status
            post :retry
          end
        end
603

Vinnie Okada's avatar
Vinnie Okada committed
604
605
606
607
        resources :hooks, only: [:index, :create, :destroy], constraints: { id: /\d+/ } do
          member do
            get :test
          end
608
        end
609

610
        resources :milestones, constraints: { id: /\d+/ } do
Vinnie Okada's avatar
Vinnie Okada committed
611
612
613
614
          member do
            put :sort_issues
            put :sort_merge_requests
          end
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
615
        end
616

Vinnie Okada's avatar
Vinnie Okada committed
617
618
619
620
        resources :labels, constraints: { id: /\d+/ } do
          collection do
            post :generate
          end
621
        end
622

Vinnie Okada's avatar
Vinnie Okada committed
623
        resources :issues, constraints: { id: /\d+/ }, except: [:destroy] do
Valery Sizov's avatar
Valery Sizov committed
624
          member do
Valery Sizov's avatar
tests    
Valery Sizov committed
625
            post :toggle_subscription
Valery Sizov's avatar
Valery Sizov committed
626
          end
Vinnie Okada's avatar
Vinnie Okada committed
627
628
629
          collection do
            post  :bulk_update
          end
630
        end
Robert Speicher's avatar
Robert Speicher committed
631

632
        resources :project_members, except: [:new, :edit], constraints: { id: /[a-zA-Z.\/0-9_\-#%+]+/ } do
Vinnie Okada's avatar
Vinnie Okada committed
633
634
          collection do
            delete :leave
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
635

Vinnie Okada's avatar
Vinnie Okada committed
636
637
638
639
640
            # Used for import team
            # from another project
            get :import
            post :apply_import
          end
641
642
643
644

          member do
            post :resend_invite
          end
645
        end
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
646

Vinnie Okada's avatar
Vinnie Okada committed
647
648
649
650
        resources :notes, only: [:index, :create, :destroy, :update], constraints: { id: /\d+/ } do
          member do
            delete :delete_attachment
          end
651
        end
652
653
654

        resources :uploads, only: [:create] do
          collection do
655
            get ":secret/:filename", action: :show, as: :show, constraints: { filename: /[^\/]+/ }
656
          end
657
        end
658

659
660
661
662
663
664
665
        resources :runners, only: [:index, :edit, :update, :destroy, :show] do
          member do
            get :resume
            get :pause
          end
        end
      end
666
    end
gitlabhq's avatar
gitlabhq committed
667
  end
Robert Speicher's avatar
Robert Speicher committed
668

669
  get ':id' => 'namespaces#show', constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ }
gitlabhq's avatar
gitlabhq committed
670
end