2021-01-03 14:25:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Resolvers
|
|
|
|
class BoardResolver < BaseResolver.single
|
2021-04-29 21:17:54 +05:30
|
|
|
alias_method :parent, :object
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
type Types::BoardType, null: true
|
|
|
|
|
|
|
|
argument :id, ::Types::GlobalIDType[::Board],
|
|
|
|
required: true,
|
2021-10-27 15:23:28 +05:30
|
|
|
description: 'ID of the board.'
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
def resolve(id: nil)
|
|
|
|
return unless parent
|
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
::Boards::BoardsFinder.new(parent, context[:current_user], board_id: extract_board_id(id)).execute.first
|
2021-01-03 14:25:43 +05:30
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def extract_board_id(gid)
|
|
|
|
GitlabSchema.parse_gid(gid, expected_type: ::Board).model_id
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|