debian-mirror-gitlab/lib/api/project_debian_distributions.rb
2021-10-27 15:23:28 +05:30

35 lines
829 B
Ruby

# frozen_string_literal: true
module API
class ProjectDebianDistributions < ::API::Base
params do
requires :id, type: String, desc: 'The ID of a project'
end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
rescue_from ArgumentError do |e|
render_api_error!(e.message, 400)
end
rescue_from ActiveRecord::RecordInvalid do |e|
render_api_error!(e.message, 400)
end
after_validation do
require_packages_enabled!
not_found! unless ::Feature.enabled?(:debian_packages, user_project)
end
namespace ':id' do
helpers do
def project_or_group
user_project
end
end
include ::API::Concerns::Packages::DebianDistributionEndpoints
end
end
end
end