summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoren De Groof <git@jorendegroof.be>2017-02-16 10:08:18 +0100
committerJoren De Groof <git@jorendegroof.be>2017-02-17 09:47:23 +0100
commitaa7c8be5c654000fe71a59e4f8ff22bd3a3e1219 (patch)
treedd67643824f660f410f913417cd5192233b378d9 /lib
parentb08be1659826ae3f0b645334e59f0a2861a709eb (diff)
downloadgitlab-ce-aa7c8be5c654000fe71a59e4f8ff22bd3a3e1219.tar.gz
Add API endpoint to get all milestone merge requests
Diffstat (limited to 'lib')
-rw-r--r--lib/api/milestones.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/api/milestones.rb b/lib/api/milestones.rb
index 3c373a84ec5..0b4ed76b35c 100644
--- a/lib/api/milestones.rb
+++ b/lib/api/milestones.rb
@@ -120,6 +120,28 @@ module API
issues = IssuesFinder.new(current_user, finder_params).execute
present paginate(issues), with: Entities::Issue, current_user: current_user, project: user_project
end
+
+ desc 'Get all merge requests for a single project milestone' do
+ detail 'This feature was introduced in GitLab 9.'
+ success Entities::MergeRequest
+ end
+ params do
+ requires :milestone_id, type: Integer, desc: 'The ID of a project milestone'
+ use :pagination
+ end
+ get ':id/milestones/:milestone_id/merge_requests' do
+ authorize! :read_milestone, user_project
+
+ milestone = user_project.milestones.find(params[:milestone_id])
+
+ finder_params = {
+ project_id: user_project.id,
+ milestone_id: milestone.id
+ }
+
+ merge_requests = MergeRequestsFinder.new(current_user, finder_params).execute
+ present paginate(merge_requests), with: Entities::MergeRequest, current_user: current_user, project: user_project
+ end
end
end
end