Files
openfoodnetwork/app/controllers/api/customers_controller.rb
Rob Harrington ddb9ae1140 Load all shops that a user is associated with as a customer
Regardless of the presence of an order
2018-06-24 16:28:47 +10:00

20 lines
514 B
Ruby

module Api
class CustomersController < BaseController
def index
@customers = current_api_user.customers.of_regular_shops
render json: @customers, each_serializer: CustomerSerializer
end
def update
@customer = Customer.find(params[:id])
authorize! :update, @customer
if @customer.update_attributes(params[:customer])
render json: @customer, serializer: CustomerSerializer, status: 200
else
invalid_resource!(@customer)
end
end
end
end