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?
23 lines
399 B
Ruby
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
|