debian-mirror-gitlab/app/graphql/mutations/metrics/dashboard/annotations/delete.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
787 B
Ruby
Raw Normal View History

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
2021-01-29 00:20:46 +05:30
argument :id, ::Types::GlobalIDType[::Metrics::Dashboard::Annotation],
2020-06-23 00:09:42 +05:30
required: true,
2021-03-08 18:12:59 +05:30
description: '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