Welcome to mirror list, hosted at ThFree Co, Russian Federation.

issue_status_counts_resolver.rb « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0b26b9def5402d900367ca6f463a4b9e0c72dab3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

module Resolvers
  class IssueStatusCountsResolver < BaseResolver
    prepend IssueResolverFields

    type Types::IssueStatusCountsType, null: true

    def continue_issue_resolve(parent, finder, **args)
      finder.params[parent_param(parent)] = parent if parent
      Gitlab::IssuablesCountForState.new(finder, parent)
    end

    private

    def parent_param(parent)
      case parent
      when Project
        :project_id
      when Group
        :group_id
      else
        raise "Unexpected type of parent: #{parent.class}. Must be Project or Group"
      end
    end
  end
end