2020-05-06 12:09:36 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module AlertManagement
|
|
|
|
class Base < BaseMutation
|
2020-09-10 21:08:28 +00:00
|
|
|
include Gitlab::Utils::UsageData
|
2020-05-06 12:09:36 +00:00
|
|
|
|
2021-07-23 15:09:21 +00:00
|
|
|
argument :project_path, GraphQL::Types::ID,
|
2020-05-06 12:09:36 +00:00
|
|
|
required: true,
|
2021-08-10 12:11:00 +00:00
|
|
|
description: "Project the alert to mutate is in."
|
2020-05-06 12:09:36 +00:00
|
|
|
|
2021-07-23 15:09:21 +00:00
|
|
|
argument :iid, GraphQL::Types::String,
|
2020-05-06 12:09:36 +00:00
|
|
|
required: true,
|
2021-08-10 12:11:00 +00:00
|
|
|
description: "IID of the alert to mutate."
|
2020-05-06 12:09:36 +00:00
|
|
|
|
|
|
|
field :alert,
|
|
|
|
Types::AlertManagement::AlertType,
|
|
|
|
null: true,
|
2021-08-10 12:11:00 +00:00
|
|
|
description: "Alert after mutation."
|
2020-05-06 12:09:36 +00:00
|
|
|
|
2020-07-17 00:09:37 +00:00
|
|
|
field :todo,
|
|
|
|
Types::TodoType,
|
|
|
|
null: true,
|
2021-08-10 12:11:00 +00:00
|
|
|
description: "To-do item after mutation."
|
2020-07-17 00:09:37 +00:00
|
|
|
|
2020-05-15 15:08:04 +00:00
|
|
|
field :issue,
|
|
|
|
Types::IssueType,
|
|
|
|
null: true,
|
2021-08-10 12:11:00 +00:00
|
|
|
description: "Issue created after mutation."
|
2020-05-15 15:08:04 +00:00
|
|
|
|
2020-05-07 21:09:26 +00:00
|
|
|
authorize :update_alert_management_alert
|
2020-05-06 12:09:36 +00:00
|
|
|
|
|
|
|
private
|
|
|
|
|
2020-11-10 12:08:57 +00:00
|
|
|
def find_object(project_path:, **args)
|
|
|
|
project = Project.find_by_full_path(project_path)
|
2020-05-06 12:09:36 +00:00
|
|
|
|
|
|
|
return unless project
|
|
|
|
|
2020-11-10 12:08:57 +00:00
|
|
|
::AlertManagement::AlertsFinder.new(current_user, project, args).execute.first
|
2020-05-06 12:09:36 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|