diff options
author | Rémy Coutable <remy@rymai.me> | 2017-02-17 12:48:29 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-02-17 12:48:29 +0000 |
commit | 5cc9ebbe14ce35de1ec45fc7abce3aa9f408ddf2 (patch) | |
tree | 0be1ab14a5df60f6b1459350ec8692f2a9cdf80a /lib | |
parent | 35824650433c319a817428029b096743a18caa6f (diff) | |
parent | aa7c8be5c654000fe71a59e4f8ff22bd3a3e1219 (diff) | |
download | gitlab-ce-5cc9ebbe14ce35de1ec45fc7abce3aa9f408ddf2.tar.gz |
Merge branch '22018-api-milestone-merge-requests' into 'master'
Add API endpoint to get all milestone merge requests
Closes #22018
See merge request !9298
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/milestones.rb | 22 |
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 |