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