debian-mirror-gitlab/app/graphql/mutations/alert_management/create_alert_issue.rb

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

34 lines
849 B
Ruby
Raw Normal View History

2020-05-24 23:13:21 +05:30
# frozen_string_literal: true
module Mutations
module AlertManagement
class CreateAlertIssue < Base
graphql_name 'CreateAlertIssue'
def resolve(args)
alert = authorized_find!(project_path: args[:project_path], iid: args[:iid])
result = create_alert_issue(alert, current_user)
2023-03-04 22:38:38 +05:30
track_alert_events('incident_management_incident_created', alert)
2021-02-22 17:27:13 +05:30
track_usage_event(:incident_management_alert_create_incident, current_user.id)
2020-11-24 15:15:51 +05:30
2020-05-24 23:13:21 +05:30
prepare_response(alert, result)
end
private
def create_alert_issue(alert, user)
::AlertManagement::CreateAlertIssueService.new(alert, user).execute
end
def prepare_response(alert, result)
{
alert: alert,
2022-11-25 23:54:43 +05:30
issue: result[:issue],
errors: result.errors
2020-05-24 23:13:21 +05:30
}
end
end
end
end