Class: Resolvers::ReleasesResolver

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

Constant Summary collapse

SORT_TO_PARAMS_MAP =
{
  released_at_desc: { order_by: 'released_at', sort: 'desc' },
  released_at_asc: { order_by: 'released_at', sort: 'asc' },
  created_desc: { order_by: 'created_at', sort: 'desc' },
  created_asc: { order_by: 'created_at', sort: 'asc' }
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

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

This resolver has a custom singular resolver


14
15
16
# File 'app/graphql/resolvers/releases_resolver.rb', line 14

def self.single
  Resolvers::ReleaseResolver
end

Instance Method Details

#resolve(sort:) ⇒ Object


25
26
27
28
29
30
31
32
33
# File 'app/graphql/resolvers/releases_resolver.rb', line 25

def resolve(sort:)
  return unless Feature.enabled?(:graphql_release_data, project, default_enabled: true)

  ReleasesFinder.new(
    project,
    current_user,
    SORT_TO_PARAMS_MAP[sort]
  ).execute
end