Files
mozo-backend/app/serializers/waiter/product_serializer.rb
T
2025-09-20 17:35:58 -05:00

16 lines
449 B
Ruby

class Waiter::ProductSerializer
include Mozo::WaiterBaseSerializer
attributes :name, :price, :description, :code, :position, :visible, :active
attribute :image do
if object.image.present?
{small: object.image.url(:small)}
else
{small: object.image.url}
end
end
has_many :product_variants, serializer: Waiter::ProductVariantSerializer
has_one :product_category, serializer: Waiter::ProductCategorySerializer
end