Handle note saving with a new action on existing API controller

This commit is contained in:
Jean-Baptiste Bellet
2022-06-29 11:24:21 +02:00
parent 3f1099d968
commit 90af6bd22d
3 changed files with 31 additions and 2 deletions

View File

@@ -26,6 +26,13 @@ module Api
}
end
def update
authorize! :admin, order
order.update!(order_params)
render json: order, serializer: Api::OrderDetailedSerializer, current_order: order
end
def ship
authorize! :admin, order
@@ -72,6 +79,10 @@ module Api
includes(line_items: { variant: [:product, :stock_items, :default_price] }).
first!
end
def order_params
params.permit(:note)
end
end
end
end