summaryrefslogtreecommitdiff
path: root/app/graphql/resolvers/group_labels_resolver.rb
blob: b88f62b984ab8bf296020d5fe97e306a1c47c377 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module Resolvers
  class GroupLabelsResolver < LabelsResolver
    type Types::LabelType.connection_type, null: true

    argument :include_descendant_groups, GraphQL::Types::Boolean,
             required: false,
             description: 'Include labels from descendant groups.',
             default_value: false

    argument :only_group_labels, GraphQL::Types::Boolean,
             required: false,
             description: 'Include only group level labels.',
             default_value: false

    before_connection_authorization do |nodes, current_user|
      Preloaders::LabelsPreloader.new(nodes, current_user).preload_all
    end
  end
end