2020-05-06 12:09:36 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module AlertManagement
|
|
|
|
class Base < BaseMutation
|
|
|
|
include Mutations::ResolvesProject
|
|
|
|
|
|
|
|
argument :project_path, GraphQL::ID_TYPE,
|
|
|
|
required: true,
|
|
|
|
description: "The project the alert to mutate is in"
|
|
|
|
|
|
|
|
argument :iid, GraphQL::STRING_TYPE,
|
|
|
|
required: true,
|
|
|
|
description: "The iid of the alert to mutate"
|
|
|
|
|
|
|
|
field :alert,
|
|
|
|
Types::AlertManagement::AlertType,
|
|
|
|
null: true,
|
|
|
|
description: "The alert after mutation"
|
|
|
|
|
2020-05-07 21:09:26 +00:00
|
|
|
authorize :update_alert_management_alert
|
2020-05-06 12:09:36 +00:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def find_object(project_path:, iid:)
|
|
|
|
project = resolve_project(full_path: project_path)
|
|
|
|
|
|
|
|
return unless project
|
|
|
|
|
|
|
|
resolver = Resolvers::AlertManagementAlertResolver.single.new(object: project, context: context, field: nil)
|
|
|
|
resolver.resolve(iid: iid)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|