blob: f2a8f2b853a9efb67eb5f2da734eaa96e771184c (
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 Packages
class DestroyFile < ::Mutations::BaseMutation
graphql_name 'DestroyPackageFile'
authorize :destroy_package
argument :id,
::Types::GlobalIDType[::Packages::PackageFile],
required: true,
description: 'ID of the Package file.'
def resolve(id:)
package_file = authorized_find!(id: id)
if package_file.update(status: :pending_destruction)
return { errors: [] }
end
{ errors: package_file.errors.full_messages }
end
private
def find_object(id:)
GitlabSchema.find_by_gid(id)
end
end
end
end
|