diff options
Diffstat (limited to 'app/graphql/mutations/metrics/dashboard/annotations/delete.rb')
-rw-r--r-- | app/graphql/mutations/metrics/dashboard/annotations/delete.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/app/graphql/mutations/metrics/dashboard/annotations/delete.rb b/app/graphql/mutations/metrics/dashboard/annotations/delete.rb new file mode 100644 index 00000000000..fb828ba0e2f --- /dev/null +++ b/app/graphql/mutations/metrics/dashboard/annotations/delete.rb @@ -0,0 +1,32 @@ +# 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, + description: 'The global id of the annotation to delete' + + 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 |