debian-mirror-gitlab/app/graphql/resolvers/merge_requests_count_resolver.rb
2021-10-27 15:23:28 +05:30

17 lines
435 B
Ruby

# frozen_string_literal: true
module Resolvers
class MergeRequestsCountResolver < BaseResolver
type GraphQL::Types::Int, null: true
def resolve
BatchLoader::GraphQL.for(object.id).batch do |ids, loader, args|
counts = MergeRequestsClosingIssues.count_for_collection(ids, context[:current_user]).to_h
ids.each do |id|
loader.call(id, counts[id] || 0)
end
end
end
end
end