gitlab-org--gitlab-foss/app/finders/merge_requests_finder.rb
Toon Claes d7505de8b3 Add top-level /merge_requests API endpoint
And add support for additional query parameters:
- `author_id`: Returns merge requests created by the given user `id`
- `assignee_id`: Returns merge requests assigned to the given user `id`
- `scope`: Return merge requests for the given scope: `created-by-me`, `assigned-to-me` or `all`
2017-07-27 23:34:57 +02:00

30 lines
670 B
Ruby

# Finders::MergeRequest class
#
# Used to filter MergeRequests collections by set of params
#
# Arguments:
# current_user - which user use
# params:
# scope: 'created-by-me' or 'assigned-to-me' or 'all'
# state: 'open', 'closed', 'merged', or 'all'
# group_id: integer
# project_id: integer
# milestone_title: string
# author_id: integer
# assignee_id: integer
# search: string
# label_name: string
# sort: string
# non_archived: boolean
#
class MergeRequestsFinder < IssuableFinder
def klass
MergeRequest
end
private
def item_project_ids(items)
items&.reorder(nil)&.select(:target_project_id)
end
end