Class: Resolvers::ErrorTracking::SentryErrorsResolver

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseResolver

as_single, complexity, complexity_multiplier, #current_user, last, #object, #offset_pagination, requires_argument!, resolver_complexity, #select_result, single, #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

.field_optionsObject


35
36
37
# File 'app/graphql/resolvers/error_tracking/sentry_errors_resolver.rb', line 35

def self.field_options
  super.merge(connection: false) # we manage the pagination manually, so opt out of the connection field extension
end

Instance Method Details

#resolve(**args) ⇒ Object


20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/graphql/resolvers/error_tracking/sentry_errors_resolver.rb', line 20

def resolve(**args)
  args[:cursor] = args.delete(:after)

  result = ::ErrorTracking::ListIssuesService.new(project, current_user, args).execute

  next_cursor = result.dig(:pagination, 'next', 'cursor')
  previous_cursor = result.dig(:pagination, 'previous', 'cursor')
  issues = result[:issues]

  # ReactiveCache is still fetching data
  return if issues.nil?

  Gitlab::Graphql::ExternallyPaginatedArray.new(previous_cursor, next_cursor, *issues)
end