From 0eaa82ad61d2fda42b2dd5cf58cc08654b2d69ef Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 11 Sep 2020 12:08:50 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/graphql/mutations/boards/destroy.rb | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 app/graphql/mutations/boards/destroy.rb (limited to 'app/graphql/mutations') diff --git a/app/graphql/mutations/boards/destroy.rb b/app/graphql/mutations/boards/destroy.rb new file mode 100644 index 00000000000..7c381113d38 --- /dev/null +++ b/app/graphql/mutations/boards/destroy.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +module Mutations + module Boards + class Destroy < ::Mutations::BaseMutation + graphql_name 'DestroyBoard' + + field :board, + Types::BoardType, + null: true, + description: 'The board after mutation' + argument :id, + ::Types::GlobalIDType[::Board], + required: true, + description: 'The global ID of the board to destroy' + + authorize :admin_board + + def resolve(id:) + board = authorized_find!(id: id) + + response = ::Boards::DestroyService.new(board.resource_parent, current_user).execute(board) + + { + board: response.success? ? nil : board, + errors: response.errors + } + end + + private + + def find_object(id:) + GitlabSchema.object_from_id(id, expected_type: ::Board) + end + end + end +end -- cgit v1.2.1