many important fixes
This commit is contained in:
@@ -2,6 +2,7 @@ module Users
|
||||
class ListsController < Users::ApplicationController
|
||||
|
||||
def index
|
||||
return current if params[:currentList].present?
|
||||
#lists = current_user.lists.include_relation(:supplier, :table)
|
||||
lists = List.for_user(current_user, page: params[:page], per_page: params[:per_page].presence || 25)
|
||||
#lists.include_relation(:supplier)
|
||||
@@ -25,6 +26,13 @@ module Users
|
||||
render json: @table
|
||||
end
|
||||
|
||||
def orders
|
||||
@list = List.find(params[:id])
|
||||
return render json: {ok: false, status: 403}, status: 403 unless @list.user_ids.include?(current_user.id)
|
||||
@list.orders.include_relations(:product_orders)
|
||||
render json: @list.orders, serializer: Users::OrderSerializer, is_collection: true, include: %w[product_orders]
|
||||
end
|
||||
|
||||
def show
|
||||
@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)
|
||||
|
||||
Reference in New Issue
Block a user