debian-mirror-gitlab/app/graphql/mutations/releases/delete.rb

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

41 lines
959 B
Ruby
Raw Normal View History

2021-02-22 17:27:13 +05:30
# frozen_string_literal: true
module Mutations
module Releases
class Delete < Base
graphql_name 'ReleaseDelete'
field :release,
Types::ReleaseType,
null: true,
2021-10-27 15:23:28 +05:30
description: 'Deleted release.'
2021-02-22 17:27:13 +05:30
2021-10-27 15:23:28 +05:30
argument :tag_name, GraphQL::Types::String,
2021-02-22 17:27:13 +05:30
required: true, as: :tag,
description: 'Name of the tag associated with the release to delete.'
authorize :destroy_release
def resolve(project_path:, tag:)
2021-03-11 19:13:27 +05:30
project = authorized_find!(project_path)
2021-02-22 17:27:13 +05:30
params = { tag: tag }.with_indifferent_access
result = ::Releases::DestroyService.new(project, current_user, params).execute
if result[:status] == :success
{
release: result[:release],
errors: []
}
else
{
release: nil,
errors: [result[:message]]
}
end
end
end
end
end