mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-26 21:16:06 +10:00
Add per-milestone issues API call
This commit is contained in:
committed by
Hannes Rosenögger
parent
2b10520b30
commit
9d271538a8
@@ -75,6 +75,21 @@ module API
|
||||
render_api_error!("Failed to update milestone #{milestone.errors.messages}", 400)
|
||||
end
|
||||
end
|
||||
|
||||
# Get all issues for single project milestone
|
||||
#
|
||||
# Parameters:
|
||||
# id (required) - The ID of a project
|
||||
# milestone_id (required) - The ID of a project milestone
|
||||
# Example Request:
|
||||
# GET /projects/:id/milestones/:milestone_id/issues
|
||||
get ":id/milestones/:milestone_id/issues" do
|
||||
authorize! :read_milestone, user_project
|
||||
|
||||
@milestone = user_project.milestones.find(params[:milestone_id])
|
||||
present paginate(@milestone.issues), with: Entities::Issue
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -96,4 +96,18 @@ describe API::API, api: true do
|
||||
state_event: 'close'
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET /projects/:id/milestones/:milestone_id/issues" do
|
||||
it "should return project issues for a particular milestone" do
|
||||
get api("/projects/#{project.id}/milestones/#{milestone.id}/issues", user)
|
||||
response.status.should == 200
|
||||
json_response.should be_an Array
|
||||
json_response.first['milestone']['title'].should == milestone.title
|
||||
end
|
||||
|
||||
it "should return a 401 error if user not authenticated" do
|
||||
get api("/projects/#{project.id}/milestones/#{milestone.id}/issues")
|
||||
response.status.should == 401
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user