build endpoints

This commit is contained in:
2026-08-05 20:12:35 +02:00
parent 1e974bdcc9
commit 4e2c45dc45
25 changed files with 603 additions and 252 deletions
@@ -22,10 +22,9 @@ module WarpEngine
end
end
MAX_UPLOAD_SIZE = 100 * 1024 * 1024 # 100MB
def upload(relative_dir, uploaded_file)
raise ArgumentError, "File too large (max 100MB)" if uploaded_file.size > MAX_UPLOAD_SIZE
max = WarpEngine.config.max_upload_size
raise ArgumentError, "File too large (max #{max / (1024 * 1024)}MB)" if uploaded_file.size > max
dir = safe_path!(relative_dir)
raise ArgumentError, "Not a directory" unless dir.directory?
+2 -1
View File
@@ -2,8 +2,9 @@ module WarpEngine
class SoftwareService
include SoftwareResponseBuilder
def index
def index(owner_id: nil)
softwares = WarpEngine::Software.includes(releases: [ :release_assets ]).includes(:external_links, :software_images).all
softwares = softwares.where(owner_id: owner_id) if owner_id.present?
counts = download_counts_for(softwares.flat_map { |sw| sw.releases.map(&:id) })
{ softwares: softwares.map { |sw| build_response(sw, sw.releases.to_a, counts) } }
end