blob: 47b3535d631e4457a4040903bf9bf606e2317fe7 (
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
33
34
35
36
37
38
39
|
# frozen_string_literal: true
module Mutations
module Ci
module JobArtifact
class Destroy < BaseMutation
graphql_name 'ArtifactDestroy'
authorize :destroy_artifacts
ArtifactID = ::Types::GlobalIDType[::Ci::JobArtifact]
argument :id,
ArtifactID,
required: true,
description: 'ID of the artifact to delete.'
field :artifact,
Types::Ci::JobArtifactType,
null: true,
description: 'Deleted artifact.'
def find_object(id: )
GlobalID::Locator.locate(id)
end
def resolve(id:)
artifact = authorized_find!(id: id)
if artifact.destroy
{ errors: [] }
else
{ errors: artifact.errors.full_messages }
end
end
end
end
end
end
|