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

organization_state_counts_resolver.rb « crm « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c16a4bd24ea3f153922eac52756ce54e2e5b3e1a (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
# frozen_string_literal: true

module Resolvers
  module Crm
    class OrganizationStateCountsResolver < BaseResolver
      include Gitlab::Graphql::Authorize::AuthorizeResource

      authorize :read_crm_organization
      authorizes_object!

      type Types::CustomerRelations::OrganizationStateCountsType, null: true

      argument :search, GraphQL::Types::String,
               required: false,
               description: 'Search term to find organizations with.'

      argument :state, Types::CustomerRelations::OrganizationStateEnum,
               required: false,
               description: 'State of the organizations to search for.'

      def resolve(**args)
        ::Crm::OrganizationsFinder.counts_by_state(context[:current_user], args.merge({ group: object }))
      end
    end
  end
end