profile.py view:
added logic to check if product.quantity is > 0
if > 0: product is added to order, and the added product is sent back in the response body with 201 code
if <= 0 : "message": 'This item is out of stock' is sent back in the response body with 400 code
Changes
product.py view: @action add_to_order removed
profile.py view: added logic to check if product.quantity is > 0 if > 0: product is added to order, and the added product is sent back in the response body with 201 code if <= 0 : "message": 'This item is out of stock' is sent back in the response body with 400 code
Requests / Responses
Request
POST
/profile/cart
adds product to cartResponse
HTTP/1.1 201 OK
Related Issues