Class: Mutations::WorkItems::SavedViews::Reorder

Inherits:
BaseMutation
  • Object
show all
Defined in:
app/graphql/mutations/work_items/saved_views/reorder.rb

Constant Summary

Constants inherited from BaseMutation

BaseMutation::ERROR_MESSAGE

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

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

Instance Method Summary collapse

Methods inherited from BaseMutation

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

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

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

Instance Method Details

#resolve(id:, **args) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'app/graphql/mutations/work_items/saved_views/reorder.rb', line 44

def resolve(id:, **args)
  saved_view = authorized_find!(id: id)

  return feature_disabled_error unless saved_views_enabled?(saved_view)

  result = ::WorkItems::SavedViews::ReorderService.new(
    current_user: current_user,
    params: args.slice(:move_before_id, :move_after_id)
  ).execute(saved_view)

  if result.success?
    { saved_view: saved_view, errors: [] }
  else
    { saved_view: nil, errors: [result.message] }
  end
end