Class: Mutations::Boards::Issues::IssueMoveList

Inherits:
Issues::Base show all
Defined in:
app/graphql/mutations/boards/issues/issue_move_list.rb

Constant Summary

Constants inherited from Mutations::BaseMutation

Mutations::BaseMutation::ERROR_MESSAGE

Instance Method Summary collapse

Methods included from ResolvesIssuable

#resolve_issuable

Methods inherited from Mutations::BaseMutation

#api_user?, #current_user, #errors_on_object

Instance Method Details

#ready?(**args) ⇒ Boolean

Returns:

  • (Boolean)

38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/graphql/mutations/boards/issues/issue_move_list.rb', line 38

def ready?(**args)
  if move_arguments(args).blank?
    raise Gitlab::Graphql::Errors::ArgumentError,
          'At least one of the arguments fromListId, toListId, afterId or beforeId is required'
  end

  if move_list_arguments(args).one?
    raise Gitlab::Graphql::Errors::ArgumentError,
          'Both fromListId and toListId must be present'
  end

  super
end

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


52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'app/graphql/mutations/boards/issues/issue_move_list.rb', line 52

def resolve(board:, **args)
  raise_resource_not_available_error! unless board
  authorize_board!(board)

  issue = authorized_find!(project_path: args[:project_path], iid: args[:iid])
  move_params = { id: issue.id, board_id: board.id }.merge(move_arguments(args))

  move_issue(board, issue, move_params)

  {
    issue: issue.reset,
    errors: issue.errors.full_messages
  }
end