day-cohort-70 / Bangazon-API-BandyChamps

0 stars 0 forks source link

fixed 404 on cart page for newly registered user #56

Closed nicholas-davison closed 1 month ago

nicholas-davison commented 1 month ago

Description of PR that completes issue here... When a new user registered themselves and navigated to the cart page, a 404 was being thrown because there was no order matching the user id. furthermore, there was a 500 being thrown due to the database expecting a date.today() instead of a datetime.now() when setting the date for a new order.

Changes

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

GET /cart gets current users cart

Response

HTTP/1.1 200 OK

{
    "id": 10,
    "url": "http://localhost:8000/orders/10",
    "created_date": "2018-11-03",
    "payment_type": null,
    "customer": "http://localhost:8000/customers/4",
    "lineitems": [],
    "size": 0
}

Testing

Related Issues

samsheps commented 1 month ago

looks great, nick! 404 no more