mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
22 lines
534 B
Ruby
22 lines
534 B
Ruby
module Api
|
|
class CustomersController < Api::BaseController
|
|
skip_authorization_check only: :index
|
|
|
|
def index
|
|
@customers = current_api_user.customers
|
|
render json: @customers, each_serializer: CustomerSerializer
|
|
end
|
|
|
|
def update
|
|
@customer = Customer.find(params[:id])
|
|
authorize! :update, @customer
|
|
|
|
if @customer.update(params[:customer])
|
|
render json: @customer, serializer: CustomerSerializer, status: :ok
|
|
else
|
|
invalid_resource!(@customer)
|
|
end
|
|
end
|
|
end
|
|
end
|