gitlab-org--gitlab-foss/lib/gitlab/graphql/loaders/batch_project_statistics_loader.rb
Brett Walker aa7b1cfc5b Upgrade GraphQL gem to 1.8.17
- Due to https://github.com/exAspArk/batch-loader/pull/32,
we  changed BatchLoader.for into BatchLoader::GraphQL.for
- since our results are wrapped in a BatchLoader::GraphQL,
calling `sync` during authorization is required to get real object
- `graphql` now has it's own authorization system.  Our
`authorized?` method conflicted and required renaming
2019-09-04 17:42:48 +00:00

23 lines
544 B
Ruby

# frozen_string_literal: true
module Gitlab
module Graphql
module Loaders
class BatchProjectStatisticsLoader
attr_reader :project_id
def initialize(project_id)
@project_id = project_id
end
def find
BatchLoader::GraphQL.for(project_id).batch do |project_ids, loader|
ProjectStatistics.for_project_ids(project_ids).each do |statistics|
loader.call(statistics.project_id, statistics)
end
end
end
end
end
end
end