debian-mirror-gitlab/app/graphql/mutations/alert_management/base.rb

46 lines
1.2 KiB
Ruby
Raw Normal View History

2020-05-24 23:13:21 +05:30
# frozen_string_literal: true
module Mutations
module AlertManagement
class Base < BaseMutation
2020-06-23 00:09:42 +05:30
include ResolvesProject
2020-05-24 23:13:21 +05:30
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-07-28 23:09:34 +05:30
field :todo,
Types::TodoType,
null: true,
description: "The todo after mutation"
2020-05-24 23:13:21 +05:30
field :issue,
Types::IssueType,
null: true,
description: "The issue created after mutation"
authorize :update_alert_management_alert
private
def find_object(project_path:, iid:)
project = resolve_project(full_path: project_path)
return unless project
2020-06-23 00:09:42 +05:30
resolver = Resolvers::AlertManagement::AlertResolver.single.new(object: project, context: context, field: nil)
2020-05-24 23:13:21 +05:30
resolver.resolve(iid: iid)
end
end
end
end