diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-10 15:09:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-10 15:09:22 +0000 |
commit | 37140013714814d8ffe662a372697c56eea2fde0 (patch) | |
tree | b25c0bfc62da359f97b8b3742007c07723242f93 /app/graphql/resolvers/crm | |
parent | 948023c9c900344aa1e2f334bcaae5a194873b0d (diff) | |
download | gitlab-ce-37140013714814d8ffe662a372697c56eea2fde0.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/graphql/resolvers/crm')
-rw-r--r-- | app/graphql/resolvers/crm/contacts_resolver.rb | 29 | ||||
-rw-r--r-- | app/graphql/resolvers/crm/organizations_resolver.rb | 29 |
2 files changed, 58 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..9e235669657 --- /dev/null +++ b/app/graphql/resolvers/crm/contacts_resolver.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Resolvers + module Crm + class ContactsResolver < BaseResolver + include Gitlab::Graphql::Authorize::AuthorizeResource + + 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.' + + def resolve(**args) + ::Crm::ContactsFinder.new(current_user, { group: group }.merge(args)).execute + end + + def group + object.respond_to?(:sync) ? object.sync : object + end + end + end +end diff --git a/app/graphql/resolvers/crm/organizations_resolver.rb b/app/graphql/resolvers/crm/organizations_resolver.rb new file mode 100644 index 00000000000..ef0c930a94a --- /dev/null +++ b/app/graphql/resolvers/crm/organizations_resolver.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Resolvers + module Crm + class OrganizationsResolver < BaseResolver + include Gitlab::Graphql::Authorize::AuthorizeResource + + authorize :read_crm_organization + + type Types::CustomerRelations::OrganizationType, null: true + + argument :search, GraphQL::Types::String, + required: false, + description: 'Search term used to find organizations with.' + + argument :state, Types::CustomerRelations::OrganizationStateEnum, + required: false, + description: 'State of the organization to search for.' + + def resolve(**args) + ::Crm::OrganizationsFinder.new(current_user, { group: group }.merge(args)).execute + end + + def group + object.respond_to?(:sync) ? object.sync : object + end + end + end +end |