Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sentry_errors_resolver.rb « error_tracking « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c5cf924ce7f77f64b2cdffff169bde525d5dbff9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

module Resolvers
  module ErrorTracking
    class SentryErrorsResolver < BaseResolver
      type Types::ErrorTracking::SentryErrorType.connection_type, null: true

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

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

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

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

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