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

create.rb « timeline_event « incident_management « mutations « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cbc708a253088562945d33b0e396925e726cd493 (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
# frozen_string_literal: true

module Mutations
  module IncidentManagement
    module TimelineEvent
      class Create < Base
        graphql_name 'TimelineEventCreate'

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

        argument :note, GraphQL::Types::String,
                 required: true,
                 description: 'Text note of the timeline event.'

        argument :occurred_at, Types::TimeType,
                 required: true,
                 description: 'Timestamp of when the event occurred.'

        def resolve(incident_id:, **args)
          incident = authorized_find!(id: incident_id)

          authorize!(incident)

          response ::IncidentManagement::TimelineEvents::CreateService.new(incident, current_user, args).execute
        end

        private

        def find_object(id:)
          GitlabSchema.object_from_id(id, expected_type: ::Issue).sync
        end
      end
    end
  end
end