Class: Mutations::Boards::Lists::BaseCreate

Inherits:
Mutations::BaseMutation show all
Defined in:
app/graphql/mutations/boards/lists/base_create.rb

Direct Known Subclasses

Create

Constant Summary

Constants inherited from Mutations::BaseMutation

Mutations::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 Mutations::BaseMutation

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

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

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

Instance Method Details

#ready?(**args) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
# File 'app/graphql/mutations/boards/lists/base_create.rb', line 15

def ready?(**args)
  if args.slice(*mutually_exclusive_args).size != 1
    arg_str = mutually_exclusive_args.map { |x| x.to_s.camelize(:lower) }.join(' or ')
    raise Gitlab::Graphql::Errors::ArgumentError, "one and only one of #{arg_str} is required"
  end

  super
end

#resolve(**args) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'app/graphql/mutations/boards/lists/base_create.rb', line 24

def resolve(**args)
  board  = authorized_find!(id: args[:board_id])
  params = create_list_params(args)

  response = create_list(board, params)

  {
    list: response.success? ? response.payload[:list] : nil,
    errors: response.errors
  }
end