Commit 9d271538 authored by Justin Whear's avatar Justin Whear Committed by Hannes Rosenögger

Add per-milestone issues API call

parent 2b10520b
...@@ -75,6 +75,21 @@ module API ...@@ -75,6 +75,21 @@ module API
render_api_error!("Failed to update milestone #{milestone.errors.messages}", 400) render_api_error!("Failed to update milestone #{milestone.errors.messages}", 400)
end end
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 end
end end
...@@ -96,4 +96,18 @@ describe API::API, api: true do ...@@ -96,4 +96,18 @@ describe API::API, api: true do
state_event: 'close' state_event: 'close'
end end
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 end
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