debian-mirror-gitlab/app/graphql/mutations/boards/create.rb

34 lines
803 B
Ruby
Raw Normal View History

2021-01-03 14:25:43 +05:30
# frozen_string_literal: true
module Mutations
module Boards
class Create < ::Mutations::BaseMutation
2021-01-29 00:20:46 +05:30
include Mutations::ResolvesResourceParent
2021-01-03 14:25:43 +05:30
graphql_name 'CreateBoard'
2021-02-22 17:27:13 +05:30
include Mutations::Boards::CommonMutationArguments
2021-01-03 14:25:43 +05:30
field :board,
Types::BoardType,
null: true,
2021-10-27 15:23:28 +05:30
description: 'Board after mutation.'
2021-01-03 14:25:43 +05:30
2021-04-17 20:07:23 +05:30
authorize :admin_issue_board
2021-01-03 14:25:43 +05:30
def resolve(args)
2021-01-29 00:20:46 +05:30
board_parent = authorized_resource_parent_find!(args)
2021-02-22 17:27:13 +05:30
2021-01-03 14:25:43 +05:30
response = ::Boards::CreateService.new(board_parent, current_user, args).execute
{
2021-04-17 20:07:23 +05:30
board: response.success? ? response.payload : nil,
2021-01-03 14:25:43 +05:30
errors: response.errors
}
end
end
end
end
2021-02-22 17:27:13 +05:30
2021-06-08 01:23:25 +05:30
Mutations::Boards::Create.prepend_mod_with('Mutations::Boards::Create')