2020-05-24 23:13:21 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module AlertManagement
|
|
|
|
class Base < BaseMutation
|
2020-11-24 15:15:51 +05:30
|
|
|
include Gitlab::Utils::UsageData
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
argument :project_path, GraphQL::ID_TYPE,
|
|
|
|
required: true,
|
2021-03-08 18:12:59 +05:30
|
|
|
description: "The project the alert to mutate is in."
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
argument :iid, GraphQL::STRING_TYPE,
|
|
|
|
required: true,
|
2021-03-08 18:12:59 +05:30
|
|
|
description: "The IID of the alert to mutate."
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
field :alert,
|
|
|
|
Types::AlertManagement::AlertType,
|
|
|
|
null: true,
|
2021-03-08 18:12:59 +05:30
|
|
|
description: "The alert after mutation."
|
2020-05-24 23:13:21 +05:30
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
field :todo,
|
|
|
|
Types::TodoType,
|
|
|
|
null: true,
|
2021-03-11 19:13:27 +05:30
|
|
|
description: "The to-do item after mutation."
|
2020-07-28 23:09:34 +05:30
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
field :issue,
|
|
|
|
Types::IssueType,
|
|
|
|
null: true,
|
2021-03-08 18:12:59 +05:30
|
|
|
description: "The issue created after mutation."
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
authorize :update_alert_management_alert
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
def find_object(project_path:, **args)
|
|
|
|
project = Project.find_by_full_path(project_path)
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
return unless project
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
::AlertManagement::AlertsFinder.new(current_user, project, args).execute.first
|
2020-05-24 23:13:21 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|