Class: Mutations::Achievements::Update

Inherits:
BaseMutation
  • Object
show all
Includes:
Gitlab::Graphql::Authorize::AuthorizeResource
Defined in:
app/graphql/mutations/achievements/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 included from Gitlab::Graphql::Authorize::AuthorizeResource

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

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



41
42
43
# File 'app/graphql/mutations/achievements/update.rb', line 41

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

#resolve(args) ⇒ Object



33
34
35
36
37
38
39
# File 'app/graphql/mutations/achievements/update.rb', line 33

def resolve(args)
  achievement = authorized_find!(id: args[:achievement_id])

  args.delete(:achievement_id)
  result = ::Achievements::UpdateService.new(current_user, achievement, args).execute
  { achievement: result.payload, errors: result.errors }
end