Welcome to mirror list, hosted at ThFree Co, Russian Federation.

delete.rb « annotations « dashboard « metrics « mutations « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6e183e78d9bd510c3b5d7af803d6f46617e8d4a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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