Move endpoint to list issues under lists resources

parent 1fa7274c
...@@ -23,7 +23,7 @@ class Projects::BoardIssuesController < Projects::ApplicationController ...@@ -23,7 +23,7 @@ class Projects::BoardIssuesController < Projects::ApplicationController
private private
def filter_params def filter_params
params.permit(:list_id) params.merge(id: params[:list_id])
end end
def move_params def move_params
......
...@@ -857,8 +857,11 @@ Rails.application.routes.draw do ...@@ -857,8 +857,11 @@ Rails.application.routes.draw do
end end
resource :board, only: [:show] do resource :board, only: [:show] do
resources :issues, only: [:index, :update], controller: :board_issues resources :issues, only: [:update], controller: :board_issues
resources :lists, only: [:create, :update, :destroy], controller: :board_lists
resources :lists, only: [:create, :update, :destroy], controller: :board_lists do
resources :issues, only: [:index], controller: :board_issues
end
end end
resources :todos, only: [:create] resources :todos, only: [:create]
......
...@@ -22,9 +22,7 @@ describe Projects::BoardIssuesController do ...@@ -22,9 +22,7 @@ describe Projects::BoardIssuesController do
create(:labeled_issue, project: project, labels: [development]) create(:labeled_issue, project: project, labels: [development])
create(:labeled_issue, project: project, labels: [development]) create(:labeled_issue, project: project, labels: [development])
get :index, namespace_id: project.namespace.to_param, list_issues list_id: list2
project_id: project.to_param,
list_id: list2.to_param
parsed_response = JSON.parse(response.body) parsed_response = JSON.parse(response.body)
...@@ -35,13 +33,17 @@ describe Projects::BoardIssuesController do ...@@ -35,13 +33,17 @@ describe Projects::BoardIssuesController do
context 'with invalid list id' do context 'with invalid list id' do
it 'returns a not found 404 response' do it 'returns a not found 404 response' do
get :index, namespace_id: project.namespace.to_param, list_issues list_id: 999
project_id: project.to_param,
id: 999
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
end end
end end
def list_issues(list_id:)
get :index, namespace_id: project.namespace.to_param,
project_id: project.to_param,
list_id: list_id.to_param
end
end end
describe 'PATCH #update' do describe 'PATCH #update' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment