Class: Resolvers::BoardsResolver

Inherits:
BaseResolver
  • Object
show all
Defined in:
app/graphql/resolvers/boards_resolver.rb

Instance Method Summary collapse

Methods inherited from BaseResolver

complexity, complexity_multiplier, #current_user, last, #object, resolver_complexity, #select_result, single, #single?, #synchronized_object

Methods included from Gitlab::Utils::Override

#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Instance Method Details

#resolve(id: nil) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/graphql/resolvers/boards_resolver.rb', line 11

def resolve(id: nil)
  # The project or group could have been loaded in batch by `BatchLoader`.
  # At this point we need the `id` of the project/group to query for boards, so
  # make sure it's loaded and not `nil` before continuing.
  parent = object.respond_to?(:sync) ? object.sync : object

  return Board.none unless parent

  Boards::ListService.new(parent, context[:current_user], board_id: extract_board_id(id)).execute(create_default_board: false)
rescue ActiveRecord::RecordNotFound
  Board.none
end