summaryrefslogtreecommitdiff
path: root/config/routes/group.rb
blob: 826048ba196cf9290cd624c4022f034860bbce2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require 'constraints/group_url_constrainer'

constraints(GroupUrlConstrainer.new) do
  scope(path: ':id',
        as: :group,
        constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ },
        controller: :groups) do
    get '/', action: :show
    patch '/', action: :update
    put '/', action: :update
    delete '/', action: :destroy
  end
end

scope constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } do
  resources :groups, except: [:show] do
    member do
      get :issues
      get :merge_requests
      get :projects
      get :activity
    end

    scope module: :groups do
      resources :group_members, only: [:index, :create, :update, :destroy], concerns: :access_requestable do
        post :resend_invite, on: :member
        delete :leave, on: :collection
      end

      resource :avatar, only: [:destroy]
      resources :milestones, constraints: { id: /[^\/]+/ }, only: [:index, :show, :update, :new, :create]

      resources :labels, except: [:show], constraints: { id: /\d+/ }
    end
  end
  get 'groups/:id' => 'groups#show', as: :group_canonical
end