Class: Resolvers::DesignManagement::Version::DesignAtVersionResolver

Inherits:
BaseResolver
  • Object
show all
Includes:
Gitlab::Graphql::Authorize::AuthorizeResource
Defined in:
app/graphql/resolvers/design_management/version/design_at_version_resolver.rb

Overview

Resolver for a DesignAtVersion object given an implicit version context

Constant Summary

Constants included from Gitlab::Graphql::Authorize::AuthorizeResource

Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Gitlab::Graphql::Authorize::AuthorizeResource

#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!

Methods inherited from BaseResolver

complexity, complexity_multiplier, #current_user, last, #object, resolver_complexity, #select_result, #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?

Class Method Details

.singleObject


25
26
27
# File 'app/graphql/resolvers/design_management/version/design_at_version_resolver.rb', line 25

def self.single
  self
end

Instance Method Details

#resolve(design_id: nil, filename: nil, design_at_version_id: nil) ⇒ Object


29
30
31
32
33
34
35
36
# File 'app/graphql/resolvers/design_management/version/design_at_version_resolver.rb', line 29

def resolve(design_id: nil, filename: nil, design_at_version_id: nil)
  validate_arguments(design_id, filename, design_at_version_id)

  return unless Ability.allowed?(current_user, :read_design, issue)
  return specific_design_at_version(design_at_version_id) if design_at_version_id

  find(design_id, filename).map { |d| make(d) }.first
end