Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/mutations/boards/lists/create.rb')
-rw-r--r--app/graphql/mutations/boards/lists/create.rb51
1 files changed, 12 insertions, 39 deletions
diff --git a/app/graphql/mutations/boards/lists/create.rb b/app/graphql/mutations/boards/lists/create.rb
index 9eb9a4d4b87..f3aae9ac9c8 100644
--- a/app/graphql/mutations/boards/lists/create.rb
+++ b/app/graphql/mutations/boards/lists/create.rb
@@ -3,59 +3,32 @@
module Mutations
module Boards
module Lists
- class Create < Base
+ class Create < BaseCreate
graphql_name 'BoardListCreate'
- argument :backlog, GraphQL::BOOLEAN_TYPE,
- required: false,
- description: 'Create the backlog list.'
+ argument :board_id, ::Types::GlobalIDType[::Board],
+ required: true,
+ description: 'Global ID of the issue board to mutate.'
- argument :label_id, ::Types::GlobalIDType[::Label],
- required: false,
- description: 'Global ID of an existing label.'
+ field :list,
+ Types::BoardListType,
+ null: true,
+ description: 'Issue list in the issue board.'
- 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
+ authorize :admin_list
- super
- end
-
- def resolve(**args)
- board = authorized_find!(id: args[:board_id])
- params = create_list_params(args)
-
- response = create_list(board, params)
+ private
- {
- list: response.success? ? response.payload[:list] : nil,
- errors: response.errors
- }
+ def find_object(id:)
+ GitlabSchema.object_from_id(id, expected_type: ::Board)
end
- private
-
def create_list(board, params)
create_list_service =
::Boards::Lists::CreateService.new(board.resource_parent, current_user, params)
create_list_service.execute(board)
end
-
- # Overridden in EE
- def create_list_params(args)
- params = args.slice(*mutually_exclusive_args).with_indifferent_access
- params[:label_id] &&= ::GitlabSchema.parse_gid(params[:label_id], expected_type: ::Label).model_id
-
- params
- end
-
- # Overridden in EE
- def mutually_exclusive_args
- [:backlog, :label_id]
- end
end
end
end