Class: Mutations::CustomerRelations::Contacts::Create

Inherits:
Base
  • Object
show all
Includes:
Gitlab::Graphql::Authorize::AuthorizeResource
Defined in:
app/graphql/mutations/customer_relations/contacts/create.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 included from Gitlab::Graphql::Authorize::AuthorizeResource

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

Methods inherited from Base

#set_organization!

Methods included from ResolvesIds

#resolve_ids

Methods inherited from BaseMutation

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

Instance Method Details

#find_object(id:) ⇒ Object



47
48
49
# File 'app/graphql/mutations/customer_relations/contacts/create.rb', line 47

def find_object(id:)
  GitlabSchema.object_from_id(id, expected_type: ::Group)
end

#resolve(args) ⇒ Object



39
40
41
42
43
44
45
# File 'app/graphql/mutations/customer_relations/contacts/create.rb', line 39

def resolve(args)
  group = authorized_find!(id: args[:group_id])

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