debian-mirror-gitlab/app/graphql/mutations/incident_management/timeline_event/create.rb

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

40 lines
1.1 KiB
Ruby
Raw Normal View History

2022-07-16 23:28:13 +05:30
# 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)
2022-07-23 23:45:48 +05:30
response ::IncidentManagement::TimelineEvents::CreateService.new(
incident, current_user, args.merge(editable: true)
).execute
2022-07-16 23:28:13 +05:30
end
private
def find_object(id:)
GitlabSchema.object_from_id(id, expected_type: ::Issue).sync
end
end
end
end
end