Base progress

This commit is contained in:
2015-09-16 11:50:55 +02:00
parent ef894f9e02
commit 6a085b1ca2
52 changed files with 3686 additions and 1818 deletions
-9
View File
@@ -1,9 +0,0 @@
class ListSerializer < Qwaiter::Serializer
# user ids for facebook pictures
#embed :ids
attributes :state, :needs_help, :needs_payment, :user_requests_closing, :is_paid, :price, :table_id, :table_number, :section_id, :user_ids, :supplier_id, :closed_at #, :has_active_orders
#def has_active_orders
#object.has_active_orders?
#end
end
-4
View File
@@ -1,4 +0,0 @@
class SectionSerializer < Qwaiter::Serializer
attributes :title, :path, :width, :height
has_many :tables
end
@@ -1,5 +0,0 @@
class SupplierTableSerializer < Qwaiter::Serializer
self.root = :table
attributes :number, :width, :height, :position_x, :position_y, :section_id, :needs_help
has_one :supplier, serializer: Suppliers::SupplierSerializer
end
-17
View File
@@ -1,17 +0,0 @@
class TableSerializer < Qwaiter::Serializer
attributes :number, :width, :height, :position_x, :position_y, :section_id, :occupied #, :alist_id
#def list_id
#object.active_list_id || object.active_list.try(:id)
#end
#def list
#object.active_list
#end
def list
object.active_list
end
has_one :list, key: :active_list_id
end
@@ -1,34 +0,0 @@
#class ListExtendedSerializer
#render json: {
#list: list.serialized_with_status_join_requests_and_supplier_counters.merge(order_ids: list.orders.map(&:id)),
#}
#.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
attributes :extended_version, :state, :needs_help, :needs_payment, :user_requests_closing, :is_paid, :price,
:table_id, :table_number, :section_id, :user_ids, :supplier_id, :closed_at, :cached_supplier_name
#:supplier_orders_in_process_count, :supplier_orders_placed_count
def has_active_orders
object.has_active_orders?
end
def cached_supplier_name
object.supplier.name
end
has_many :orders
#has_many :product_categories
has_one :table, serializer: Users::TableSerializer # this one add a lot of stuff
has_many :join_requests, serializer: JoinRequestSerializer
has_many :users, serializer: Users::UserSerializer
#has_one :supplier # added by other resource
def extended_version
true
end
end
=end
@@ -1,10 +0,0 @@
class UserExtendedSupplierSerializer < Qwaiter::Serializer
self.root = :supplier
attributes :extended_version, :open, :name, :orders_in_process_count, :orders_placed_count
has_many :product_categories
#has_many :products only product in category!!!!!!
def extended_version
true
end
end
@@ -1,5 +0,0 @@
class UserExtendedTableSerializer < Qwaiter::Serializer
self.root = :table
attributes :number, :width, :height, :position_x, :position_y, :section_id, :occupied, :needs_help
has_one :supplier, serializer: UserExtendedSupplierSerializer
end
+4 -3
View File
@@ -1,5 +1,6 @@
class Waiter::SectionSerializer < Qwaiter::Serializer
root 'section'
attributes :title, :path, :width, :height
class Waiter::SectionSerializer
include Qwaiter::WaiterBaseSerializer
attributes :title, :width, :height
has_many :tables, serializer: Waiter::TableSerializer
has_one :supplier, serializer: Waiter::SupplierSerializer
end
@@ -1,5 +1,5 @@
class Waiter::SupplierSerializer < Qwaiter::Serializer
root 'supplier'
class Waiter::SupplierSerializer
include Qwaiter::WaiterBaseSerializer
attributes :open, :name, :lat, :lng, :time_zone, :address, :house_number, :house_number_addition, :postal_code, :city, :country,
:facebook_promotion_url, :iens_profile, :week_starts_on_monday, :orders_in_process_count, :orders_placed_count
end
+2 -1
View File
@@ -1,3 +1,4 @@
class Waiter::TableSerializer < Qwaiter::Serializer
class Waiter::TableSerializer
include Qwaiter::WaiterBaseSerializer
attributes :number, :width, :height, :position_x, :position_y, :section_id, :needs_help
end