debian-mirror-gitlab/app/graphql/mutations/issues/link_alerts.rb
2023-03-05 14:24:40 +05:30

26 lines
668 B
Ruby

# frozen_string_literal: true
module Mutations
module Issues
class LinkAlerts < Base
graphql_name 'IssueLinkAlerts'
argument :alert_references, [GraphQL::Types::String],
required: true,
description: 'Alerts references to be linked to the incident.'
authorize :admin_issue
def resolve(project_path:, iid:, alert_references:)
issue = authorized_find!(project_path: project_path, iid: iid)
::IncidentManagement::LinkAlerts::CreateService.new(issue, current_user, alert_references).execute
{
issue: issue,
errors: errors_on_object(issue)
}
end
end
end
end