Files
ubicloud/serializers/project.rb
geemus 5aefc538fa Only serialize feature flags in the web serialization
An opaque hash of feature flags is awkward to type in openapi schema,
and was only used in the web views.  So limit it only to a "web"
variant of the serializer, and leave it out of the API.

It raises at least one question: is what's going on for the web views
in fact a "serialization" at all?
2024-11-24 11:57:22 -08:00

23 lines
399 B
Ruby

# frozen_string_literal: true
class Serializers::Project < Serializers::Base
def self.serialize_internal(p, options = {})
base = {
id: p.ubid,
name: p.name,
credit: p.credit.to_f,
discount: p.discount
}
if options[:include_path]
base[:path] = p.path
end
if options[:web]
base[:feature_flags] = p.feature_flags
end
base
end
end