Basic functionality working
This commit is contained in:
@@ -25,7 +25,7 @@ module Users
|
||||
end
|
||||
|
||||
def show
|
||||
@list ||= List.find(params[:id])
|
||||
@list ||= List.find(params[:id]) if params[:id]
|
||||
render json: {}, status: :not_found and return unless @list.present? && Array.wrap(@list.user_ids).include?(current_user.id)
|
||||
render json: JSONAPI::Serializer.serialize(@list, serializer: Users::ListSerializer, include: %w[supplier users])
|
||||
end
|
||||
|
||||
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user