Basic functionality working

This commit is contained in:
2015-09-08 13:31:20 +02:00
parent 1caa488524
commit d87befd00f
6 changed files with 26 additions and 13 deletions
+10 -4
View File
@@ -9,8 +9,14 @@ module Users
def supplier
table = Table.find(params[:id])
supplier = table.supplier
supplier.product_categories.include_relations(:products)
render json: JSONAPI::Serializer.serialize(supplier, serializer: Users::SupplierSerializer, include: %w[product_categories product_categories.products product_categories.supplier])
supplier.product_categories.include_relations(products: :product_variants)
render json: JSONAPI::Serializer.serialize(supplier, serializer: Users::SupplierSerializer, include: %w[
product_categories
product_categories.products
product_categories.supplier
product_categories.products.product_variants
product_categories.products.product_variants.product
])
end
# POST /tables/:id/needs_help.json
@@ -39,8 +45,8 @@ module Users
# - move_table
# into separate class and implement security in a non stupid way as it is now
def status_info
render json: json_alert('messages.table_not_found') and return unless params[:table_id].present?
table = Table.find(params[:table_id])
render json: json_alert('messages.table_not_found') and return unless params[:id].present?
table = Table.find(params[:id])
res = {}
res[:occupied] = table.occupied?
res[:reserved] = table.reserved?