debian-mirror-gitlab/app/graphql/mutations/issues/link_alerts.rb

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

27 lines
668 B
Ruby
Raw Normal View History

2023-03-04 22:38:38 +05:30
# 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