JSON api serializers for suppliers
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
class ProductVariantSerializer < Qwaiter::Serializer
|
||||
root 'product_variant'
|
||||
attributes :name
|
||||
end
|
||||
@@ -4,5 +4,6 @@ class Suppliers::OrderSerializer
|
||||
|
||||
has_one :list, serializer: Suppliers::ListSerializer
|
||||
has_many :product_orders, serializer: Suppliers::ProductOrderSerializer
|
||||
has_one :user, serializer: Suppliers::UserSerializer
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Suppliers::ProductSerializer
|
||||
include Qwaiter::SupplierBaseSerializer
|
||||
attributes :name, :price, :description, :code, :position, :visible, :active, :product_category_id
|
||||
attributes :name, :price, :description, :code, :position, :visible, :active
|
||||
attribute :image do
|
||||
if object.image.present?
|
||||
{small: object.image.url(:small)}
|
||||
@@ -10,4 +10,5 @@ class Suppliers::ProductSerializer
|
||||
end
|
||||
|
||||
has_many :product_variants, serializer: Suppliers::ProductVariantSerializer
|
||||
has_one :product_category, serializer: Suppliers::ProductSerializer
|
||||
end
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
class Suppliers::ProductVariantSerializer
|
||||
include Qwaiter::SupplierBaseSerializer
|
||||
attributes :name
|
||||
end
|
||||
@@ -1,4 +1,5 @@
|
||||
class Suppliers::SectionElementSerializer < Qwaiter::Serializer
|
||||
class Suppliers::SectionElementSerializer
|
||||
include Qwaiter::SupplierBaseSerializer
|
||||
attributes :name, :box_width, :box_height, :dpm, :svg, :position_x, :position_y, :rotation
|
||||
has_one :section, serializer: Suppliers::SectionSerializer
|
||||
end
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
class Suppliers::SectionSerializer
|
||||
include Qwaiter::SupplierBaseSerializer
|
||||
attributes :title, :path, :width, :height
|
||||
has_many :tables, serializer: Suppliers::TableSerializer
|
||||
has_many :section_areas, serializer: Suppliers::SectionAreaSerializer
|
||||
has_many :section_elements, serializer: Suppliers::SectionElementSerializer
|
||||
end
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#.merge(ActiveModel::ArraySerializer.new(list.supplier.product_categories, each_serializer: ProductCategorySerializer, root: :product_categories).as_json)
|
||||
#.merge(ActiveModel::ArraySerializer.new(list.orders, each_serializer: OrderSerializer, root: :orders).as_json)
|
||||
#end
|
||||
=begin
|
||||
class UserExtendedListSerializer < Qwaiter::Serializer
|
||||
# user ids for facebook pictures
|
||||
self.root = :list
|
||||
@@ -30,3 +31,4 @@ class UserExtendedListSerializer < Qwaiter::Serializer
|
||||
true
|
||||
end
|
||||
end
|
||||
=end
|
||||
|
||||
Reference in New Issue
Block a user