2021-01-03 14:25:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module Boards
|
|
|
|
class Create < ::Mutations::BaseMutation
|
|
|
|
graphql_name 'CreateBoard'
|
|
|
|
|
2022-04-04 11:22:00 +05:30
|
|
|
include Mutations::ResolvesResourceParent
|
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')
|