debian-mirror-gitlab/app/graphql/resolvers/incident_management/timeline_events_resolver.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1 KiB
Ruby
Raw Normal View History

2022-07-16 23:28:13 +05:30
# 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
2023-01-13 00:05:48 +05:30
def resolve_with_lookahead(**args)
2022-07-16 23:28:13 +05:30
incident = args[:incident_id].find
apply_lookahead(::IncidentManagement::TimelineEventsFinder.new(current_user, incident, args).execute)
end
2023-01-13 00:05:48 +05:30
def preloads
{
timeline_event_tags: [:timeline_event_tags]
}
end
2022-07-16 23:28:13 +05:30
end
end
end