2020-07-28 23:09:34 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module AlertManagement
|
|
|
|
module Alerts
|
|
|
|
module Todo
|
|
|
|
class Create < Base
|
|
|
|
graphql_name 'AlertTodoCreate'
|
|
|
|
|
|
|
|
def resolve(args)
|
|
|
|
alert = authorized_find!(project_path: args[:project_path], iid: args[:iid])
|
|
|
|
result = ::AlertManagement::Alerts::Todo::CreateService.new(alert, current_user).execute
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
track_alert_events('incident_management_alert_todo', alert)
|
2020-11-24 15:15:51 +05:30
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
prepare_response(result)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def prepare_response(result)
|
|
|
|
{
|
|
|
|
alert: result.payload[:alert],
|
|
|
|
todo: result.payload[:todo],
|
|
|
|
errors: result.error? ? [result.message] : []
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|