Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
296bcbd6
Commit
296bcbd6
authored
Aug 02, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add endpoint to list issues for a specific board list
parent
52b6a7e9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
99 additions
and
0 deletions
+99
-0
app/controllers/projects/board_issues_controller.rb
app/controllers/projects/board_issues_controller.rb
+22
-0
config/routes.rb
config/routes.rb
+1
-0
spec/controllers/projects/board_issues_controller_spec.rb
spec/controllers/projects/board_issues_controller_spec.rb
+46
-0
spec/fixtures/api/schemas/issue.json
spec/fixtures/api/schemas/issue.json
+30
-0
No files found.
app/controllers/projects/board_issues_controller.rb
0 → 100644
View file @
296bcbd6
class
Projects::BoardIssuesController
<
Projects
::
ApplicationController
respond_to
:json
rescue_from
ActiveRecord
::
RecordNotFound
,
with: :record_not_found
def
index
issues
=
Boards
::
Issues
::
ListService
.
new
(
project
,
current_user
,
filter_params
).
execute
issues
=
issues
.
page
(
params
[
:page
])
render
json:
issues
.
as_json
(
only:
[
:id
,
:title
,
:confidential
],
include:
{
labels:
{
only:
[
:id
,
:title
,
:color
]
}
})
end
private
def
filter_params
params
.
permit
(
:list_id
)
end
def
record_not_found
(
exception
)
render
json:
{
error:
exception
.
message
},
status: :not_found
end
end
config/routes.rb
View file @
296bcbd6
...
...
@@ -857,6 +857,7 @@ Rails.application.routes.draw do
end
resource
:board
,
only:
[
:show
]
do
resources
:issues
,
only:
[
:index
],
controller: :board_issues
resources
:lists
,
only:
[
:create
,
:update
,
:destroy
],
controller: :board_lists
end
...
...
spec/controllers/projects/board_issues_controller_spec.rb
0 → 100644
View file @
296bcbd6
require
'spec_helper'
describe
Projects
::
BoardIssuesController
do
let
(
:project
)
{
create
(
:project_with_board
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
team
<<
[
user
,
:master
]
sign_in
(
user
)
end
describe
'GET #index'
do
context
'with valid list id'
do
it
'returns issues that have the list label applied'
do
label1
=
create
(
:label
,
project:
project
,
name:
'Planning'
)
label2
=
create
(
:label
,
project:
project
,
name:
'Development'
)
create
(
:labeled_issue
,
project:
project
,
labels:
[
label1
])
create
(
:labeled_issue
,
project:
project
,
labels:
[
label2
])
create
(
:labeled_issue
,
project:
project
,
labels:
[
label2
])
create
(
:list
,
board:
project
.
board
,
label:
label1
,
position:
1
)
development
=
create
(
:list
,
board:
project
.
board
,
label:
label2
,
position:
2
)
get
:index
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
list_id:
development
.
to_param
parsed_response
=
JSON
.
parse
(
response
.
body
)
expect
(
response
).
to
match_response_schema
(
'issue'
,
array:
true
)
expect
(
parsed_response
.
length
).
to
eq
2
end
end
context
'with invalid list id'
do
it
'returns a not found 404 response'
do
get
:index
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
999
expect
(
response
).
to
have_http_status
(
404
)
end
end
end
end
spec/fixtures/api/schemas/issue.json
0 → 100644
View file @
296bcbd6
{
"type"
:
"object"
,
"required"
:
[
"id"
,
"title"
,
"confidential"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"title"
:
{
"type"
:
"string"
},
"confidential"
:
{
"type"
:
"boolean"
},
"labels"
:
{
"type"
:
[
"array"
],
"required"
:
[
"id"
,
"color"
,
"title"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"color"
:
{
"type"
:
"string"
,
"pattern"
:
"^#[0-9A-Fa-f]{3}{1,2}+$"
},
"title"
:
{
"type"
:
"string"
}
}
}
},
"additionalProperties"
:
false
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment