debian-mirror-gitlab/app/graphql/mutations/container_repositories/destroy.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
1.1 KiB
Ruby
Raw Normal View History

2021-01-29 00:20:46 +05:30
# frozen_string_literal: true
module Mutations
module ContainerRepositories
2021-02-22 17:27:13 +05:30
class Destroy < ::Mutations::ContainerRepositories::DestroyBase
2021-01-29 00:20:46 +05:30
graphql_name 'DestroyContainerRepository'
authorize :destroy_container_image
argument :id,
::Types::GlobalIDType[::ContainerRepository],
required: true,
description: 'ID of the container repository.'
field :container_repository,
Types::ContainerRepositoryType,
null: false,
2021-10-27 15:23:28 +05:30
description: 'Container repository policy after scheduling the deletion.'
2021-01-29 00:20:46 +05:30
def resolve(id:)
container_repository = authorized_find!(id: id)
container_repository.delete_scheduled!
2022-08-27 11:52:29 +05:30
# rubocop:disable CodeReuse/Worker
2021-01-29 00:20:46 +05:30
DeleteContainerRepositoryWorker.perform_async(current_user.id, container_repository.id)
2022-08-27 11:52:29 +05:30
# rubocop:enable CodeReuse/Worker
2021-01-29 00:20:46 +05:30
track_event(:delete_repository, :container)
{
container_repository: container_repository,
errors: []
}
end
end
end
end