day-cohort-70 / Bangazon-API-BandyChamps

0 stars 0 forks source link

Bug #54 fixed; can now add item to cart #60

Closed samsheps closed 1 month ago

samsheps commented 1 month ago

Changes

Imported/employed the LineItemSerializer; changed the response body to show a successful creation as client was expecting a response

Requests / Responses

If this PR contains code that defines a new request/response, or changes an existing one, please put the JSON representations here.

Request

POST /cart: adds a new product to the existing user's open cart

{
  "product_id": 88
}

Response

HTTP/1.1 201 Created

{
"id": 12,
    "product": {
        "id": 88,
        "name": "Golf",
        "price": 653.59,
        "number_sold": 0,
        "description": "1994 Volkswagen",
        "quantity": 4,
        "created_date": "2019-07-10",
        "location": "Moscow",
        "image_path": "/media/products/vehicle.png",
        "average_rating": 0
    }
}

Testing

Related Issues