Class: Mutations::CustomerRelations::Contacts::Update

Inherits:
Base
  • Object
show all
Defined in:
app/graphql/mutations/customer_relations/contacts/update.rb

Constant Summary

Constants included from Gitlab::Graphql::Authorize::AuthorizeResource

Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR

Constants inherited from BaseMutation

BaseMutation::ERROR_MESSAGE

Instance Method Summary collapse

Methods inherited from Base

#set_organization!

Methods included from Gitlab::Graphql::Authorize::AuthorizeResource

#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!

Methods included from ResolvesIds

#resolve_ids

Methods inherited from BaseMutation

#api_user?, authorization, authorized?, authorizes_object?, #current_user, #errors_on_object, #load_application_object, #ready?, #unauthorized_object

Instance Method Details

#resolve(args) ⇒ Object


41
42
43
44
45
46
47
48
49
50
51
# File 'app/graphql/mutations/customer_relations/contacts/update.rb', line 41

def resolve(args)
  contact = ::Gitlab::Graphql::Lazy.force(GitlabSchema.object_from_id(args.delete(:id), expected_type: ::CustomerRelations::Contact))
  raise_resource_not_available_error! unless contact

  group = contact.group
  authorize!(group)

  set_organization!(args)
  result = ::CustomerRelations::Contacts::UpdateService.new(group: group, current_user: current_user, params: args).execute(contact)
  { contact: result.payload, errors: result.errors }
end