give some love to the waiter app
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
class Waiter::ProductCategorySerializer
|
||||
include Qwaiter::WaiterBaseSerializer
|
||||
attributes :name, :supplier_id, :active_on_sunday, :active_on_monday, :active_on_tuesday, :active_on_wednesday,
|
||||
:active_on_thursday, :active_on_friday, :active_on_saturday, :full_day, :start_from, :end_on,
|
||||
:position
|
||||
has_many :products, serializer: Waiter::ProductSerializer
|
||||
has_one :supplier, serializer: Waiter::SupplierSerializer
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
class Waiter::ProductSerializer
|
||||
include Qwaiter::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
|
||||
@@ -0,0 +1,5 @@
|
||||
class Waiter::ProductVariantSerializer
|
||||
include Qwaiter::WaiterBaseSerializer
|
||||
attributes :name
|
||||
has_one :product, serializer: Waiter::ProductSerializer
|
||||
end
|
||||
Reference in New Issue
Block a user