2020-06-23 00:09:42 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module Metrics
|
|
|
|
module Dashboard
|
|
|
|
module Annotations
|
|
|
|
class Delete < Base
|
|
|
|
graphql_name 'DeleteAnnotation'
|
|
|
|
|
|
|
|
authorize :delete_metrics_dashboard_annotation
|
|
|
|
|
|
|
|
argument :id,
|
|
|
|
GraphQL::ID_TYPE,
|
|
|
|
required: true,
|
2020-11-24 15:15:51 +05:30
|
|
|
description: 'The global ID of the annotation to delete'
|
2020-06-23 00:09:42 +05:30
|
|
|
|
|
|
|
def resolve(id:)
|
|
|
|
annotation = authorized_find!(id: id)
|
|
|
|
|
|
|
|
result = ::Metrics::Dashboard::Annotations::DeleteService.new(context[:current_user], annotation).execute
|
|
|
|
|
|
|
|
errors = Array.wrap(result[:message])
|
|
|
|
|
|
|
|
{
|
|
|
|
errors: errors
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|