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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/resolvers/crm/contacts_resolver.rb')
-rw-r--r--app/graphql/resolvers/crm/contacts_resolver.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/app/graphql/resolvers/crm/contacts_resolver.rb b/app/graphql/resolvers/crm/contacts_resolver.rb
new file mode 100644
index 00000000000..58d0e2ce13d
--- /dev/null
+++ b/app/graphql/resolvers/crm/contacts_resolver.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+module Resolvers
+ module Crm
+ class ContactsResolver < BaseResolver
+ include Gitlab::Graphql::Authorize::AuthorizeResource
+ include ResolvesIds
+
+ authorize :read_crm_contact
+
+ type Types::CustomerRelations::ContactType, null: true
+
+ argument :search, GraphQL::Types::String,
+ required: false,
+ description: 'Search term to find contacts with.'
+
+ argument :state, Types::CustomerRelations::ContactStateEnum,
+ required: false,
+ description: 'State of the contacts to search for.'
+
+ argument :ids, [::Types::GlobalIDType[CustomerRelations::Contact]],
+ required: false,
+ description: 'Filter contacts by IDs.'
+
+ def resolve(**args)
+ args[:ids] = resolve_ids(args.delete(:ids))
+
+ ::Crm::ContactsFinder.new(current_user, { group: group }.merge(args)).execute
+ end
+
+ def group
+ object.respond_to?(:sync) ? object.sync : object
+ end
+ end
+ end
+end