- all catalog services (update/software/highlighted/builds/file/file-manager/ download/image + SoftwareResponseBuilder), the SoftwareUpdater platform services and their concerns, Blueprinter serializers (incl. TimestampFields) and the 4 DTOs now live in the engine under WarpEngine:: - constantize dispatch strings use absolute names (WarpEngine::SoftwareUpdater::<Platform>Service) - container paths read from WarpEngine.config everywhere (FileService, DownloadService, FileManagerService, ArchiveExtraction, ReleaseSerializer path rewriting); FileManagerService base path is now lazy - engine requires blueprinter itself; gemspec declares blueprinter + rubyzip - engine test suite: spec/dummy app (mysql warp_engine_test, catalog-only schema), rails_helper with engine-local factories; catalog model/service specs and factories moved from the host - host suite keeps TTG specs and loads catalog factories from the engine Verified: engine suite 40 green, host suite 14 green, /api/software and /api/builds byte-identical to baselines, admin OK. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
31 lines
1.2 KiB
Ruby
31 lines
1.2 KiB
Ruby
module WarpEngine
|
|
class SoftwareSerializer < Blueprinter::Base
|
|
include TimestampFields
|
|
|
|
field(:id) { |sw| sw.id }
|
|
field(:createdAt) { |sw| sw.created_at&.utc&.strftime(TS_FORMAT) || GO_ZERO_TIME }
|
|
field(:updatedAt) { |sw| sw.updated_at&.utc&.strftime(TS_FORMAT) || GO_ZERO_TIME }
|
|
field(:deletedAt) { |sw| sw.deleted_at&.utc&.strftime(TS_FORMAT) }
|
|
field :name
|
|
field :title
|
|
field :author
|
|
field(:desc) { |sw| sw.desc.to_s }
|
|
field(:story) { |sw| sw.story.to_s }
|
|
field(:license) { |sw| sw.license.to_s }
|
|
field :platform
|
|
field :status
|
|
field(:highlighted) { |sw| sw.highlighted ? true : false }
|
|
field(:externalLinks) { |sw| ExternalLinkSerializer.render_as_hash(sw.external_links) }
|
|
field(:platformLinks) { |sw| PlatformLinkSerializer.render_as_hash(WarpEngine::PlatformLink.for_platform(sw.platform)) }
|
|
field(:imageUrl) { |sw|
|
|
si = sw.software_images.detect(&:is_default?) || sw.software_images.first
|
|
si ? "/api/image/#{si.image_id}" : nil
|
|
}
|
|
field(:images) { |sw|
|
|
sw.software_images.map { |si|
|
|
{ url: "/api/image/#{si.image_id}", isDefault: si.is_default?, position: si.position }
|
|
}
|
|
}
|
|
end
|
|
end
|