diff options
Diffstat (limited to 'app/graphql/mutations/issues/link_alerts.rb')
-rw-r--r-- | app/graphql/mutations/issues/link_alerts.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/graphql/mutations/issues/link_alerts.rb b/app/graphql/mutations/issues/link_alerts.rb new file mode 100644 index 00000000000..c45e90c598f --- /dev/null +++ b/app/graphql/mutations/issues/link_alerts.rb @@ -0,0 +1,26 @@ +# 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 |