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

timeline_events_resolver.rb « incident_management « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0d46b1387b00f5e2e15f189428b8f50ac7f028bd (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
30
31
32
33
34
35
36
37
38
# frozen_string_literal: true

module Resolvers
  module IncidentManagement
    class TimelineEventsResolver < BaseResolver
      include LooksAhead

      alias_method :project, :object

      type ::Types::IncidentManagement::TimelineEventType.connection_type, null: true

      argument :incident_id,
               ::Types::GlobalIDType[::Issue],
               required: true,
               description: 'ID of the incident.'

      when_single do
        argument :id,
                 ::Types::GlobalIDType[::IncidentManagement::TimelineEvent],
                 required: true,
                 description: 'ID of the timeline event.',
                 prepare: ->(id, ctx) { id.model_id }
      end

      def resolve_with_lookahead(**args)
        incident = args[:incident_id].find

        apply_lookahead(::IncidentManagement::TimelineEventsFinder.new(current_user, incident, args).execute)
      end

      def preloads
        {
          timeline_event_tags: [:timeline_event_tags]
        }
      end
    end
  end
end