summaryrefslogtreecommitdiff
path: root/app/graphql/mutations/ci/pipeline/destroy.rb
blob: 3f933818ce13576ee20c5ed06a9ade0537fefe81 (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
# frozen_string_literal: true

module Mutations
  module Ci
    module Pipeline
      class Destroy < Base
        graphql_name 'PipelineDestroy'

        authorize :destroy_pipeline

        def resolve(id:)
          pipeline = authorized_find!(id: id)
          project = pipeline.project

          result = ::Ci::DestroyPipelineService.new(project, current_user).execute(pipeline)
          {
            success: result.success?,
            errors: result.errors
          }
        end
      end
    end
  end
end