Class: Resolvers::DesignManagement::VersionInCollectionResolver

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

Constant Summary collapse

VersionID =
::Types::GlobalIDType[::DesignManagement::Version]

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

as_single, complexity, complexity_multiplier, #current_user, field_options, last, #object, #offset_pagination, requires_argument!, resolver_complexity, #select_result, #single?, single_definition_blocks, singular_type, #synchronized_object, when_single

Methods included from Gitlab::Utils::Override

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

Methods included from Gitlab::Graphql::GlobalIDCompatibility

#coerce_global_id_arguments!

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Class Method Details

.singleObject


39
40
41
# File 'app/graphql/resolvers/design_management/version_in_collection_resolver.rb', line 39

def self.single
  self
end

Instance Method Details

#resolve(version_id: nil, sha: nil) ⇒ Object


26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/graphql/resolvers/design_management/version_in_collection_resolver.rb', line 26

def resolve(version_id: nil, sha: nil)
  # TODO: remove this line when the compatibility layer is removed
  # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
  version_id &&= VersionID.coerce_isolated_input(version_id)

  check_args(version_id, sha)

  ::DesignManagement::VersionsFinder
    .new(collection, current_user, sha: sha, version_id: version_id&.model_id)
    .execute
    .first
end