9b65d4bb41
- All definitions have been replaced by classes: http://graphql-ruby.org/schema/class_based_api.html - Authorization & Presentation have been refactored to work in the class based system - Loaders have been replaced by resolvers - Times are now coersed as ISO 8601
21 lines
612 B
Ruby
21 lines
612 B
Ruby
module Resolvers
|
|
class MergeRequestResolver < BaseResolver
|
|
prepend FullPathResolver
|
|
|
|
type Types::ProjectType, null: true
|
|
|
|
argument :iid, GraphQL::ID_TYPE,
|
|
required: true,
|
|
description: 'The IID of the merge request, e.g., "1"'
|
|
|
|
def resolve(full_path:, iid:)
|
|
project = model_by_full_path(Project, full_path)
|
|
return unless project.present?
|
|
|
|
BatchLoader.for(iid.to_s).batch(key: project.id) do |iids, loader|
|
|
results = project.merge_requests.where(iid: iids)
|
|
results.each { |mr| loader.call(mr.iid.to_s, mr) }
|
|
end
|
|
end
|
|
end
|
|
end
|