Base progress
This commit is contained in:
@@ -21,12 +21,12 @@ module Suppliers
|
||||
end
|
||||
@lists.include_relation(:table, :users, orders: {user: nil, product_orders: :product})
|
||||
|
||||
render json: JSONAPI::Serializer.serialize(@lists, serializer: Suppliers::ListSerializer, is_collection: true, include: %w[
|
||||
render json: @lists, include: %w[
|
||||
orders
|
||||
orders.user
|
||||
orders.product_orders
|
||||
users
|
||||
])
|
||||
]
|
||||
end
|
||||
|
||||
|
||||
@@ -52,14 +52,14 @@ module Suppliers
|
||||
@lists = List.for_supplier_created_at current_supplier, @start_time..@end_time
|
||||
@lists.include_relation(:table) # for number
|
||||
|
||||
render json: JSONAPI::Serializer.serialize(@lists, serializer: Suppliers::ListSerializer, is_collection: true, include: %w[table])
|
||||
render json: @lists, include: %w[table]
|
||||
end
|
||||
|
||||
# GET /lists/1
|
||||
# GET /lists/1.json
|
||||
def show
|
||||
@list = List.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
|
||||
render json: JSONAPI::Serializer.serialize(@list, serializer: Suppliers::ListSerializer)
|
||||
render json: @list
|
||||
end
|
||||
|
||||
# GET /lists/1/extra_info
|
||||
@@ -115,26 +115,26 @@ module Suppliers
|
||||
def destroy
|
||||
@list = List.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
|
||||
@list.destroy
|
||||
head :ok
|
||||
head :no_content
|
||||
end
|
||||
# POST /supplier/lists/1/close
|
||||
def close
|
||||
@list = List.find_by_supplier_id_and_id(current_supplier.id, params[:id])
|
||||
@list.close!
|
||||
head :ok
|
||||
head :no_content
|
||||
end
|
||||
|
||||
# POST /supplier/lists/1/mark_helped
|
||||
def mark_helped
|
||||
@list = List.find_by_supplier_id_and_id(current_supplier.id, params[:id])
|
||||
@list.mark_helped!
|
||||
head :ok
|
||||
head :no_content
|
||||
end
|
||||
|
||||
def remove_needs_payment
|
||||
@list = List.find_by_supplier_id_and_id(current_supplier.id, params[:id])
|
||||
@list.remove_needs_payment!
|
||||
head :ok
|
||||
head :no_content
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user