summaryrefslogtreecommitdiff
path: root/app/graphql/mutations/customer_relations/contacts/base.rb
blob: 5d49d48ebe2bfd92ae0abf862b4bc1438fc154eb (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
# frozen_string_literal: true

module Mutations
  module CustomerRelations
    module Contacts
      class Base < BaseMutation
        include ResolvesIds
        include Gitlab::Graphql::Authorize::AuthorizeResource

        field :contact,
              Types::CustomerRelations::ContactType,
              null: true,
              description: 'Contact after the mutation.'

        authorize :admin_crm_contact

        def set_organization!(args)
          return unless args[:organization_id]

          args[:organization_id] = args[:organization_id].model_id
        end
      end
    end
  end
end