day-cohort-70 / bangazon-api-i-like-planes-api

bangazon-api-i-like-planes-api created by GitHub Classroom
0 stars 0 forks source link

removed line creating duplicate line_items #59

Closed Doubles-101 closed 2 days ago

Doubles-101 commented 2 days ago

Fixed issue where duplicate lineitems were being displayed for this url: http://localhost:8000/profile/cart

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 http://localhost:8000/profile/cart

Response

{
    "id": 10,
    "url": "http://localhost:8000/orders/10",
    "created_date": "2018-11-03",
    "payment_type": null,
    "customer": "http://localhost:8000/customers/4",
    "lineitems": [
        {
            "id": 2,
            "product": {
                "id": 3,
                "name": "Optima",
                "price": 1655.15,
                "number_sold": 0,
                "description": "2008 Kia",
                "quantity": 3,
                "created_date": "2019-05-21",
                "location": "Seoul",
                "image_path": "http://localhost:8000/media/products/vehicle.png",
                "average_rating": null,
                "store_id": 1
            }
        },
        {
            "id": 10,
            "product": {
                "id": 2,
                "name": "Golf",
                "price": 653.59,
                "number_sold": 0,
                "description": "1994 Volkswagen",
                "quantity": 2,
                "created_date": "2019-07-10",
                "location": "Paris",
                "image_path": "http://localhost:8000/media/products/vehicle.png",
                "average_rating": null,
                "store_id": 1
            }
        },
        {
            "id": 11,
            "product": {
                "id": 22,
                "name": "Golf",
                "price": 653.59,
                "number_sold": 0,
                "description": "1994 Volkswagen",
                "quantity": 3,
                "created_date": "2019-07-10",
                "location": "Paris",
                "image_path": "http://localhost:8000/media/products/vehicle.png",
                "average_rating": null,
                "store_id": 1
            }
        },
        {
            "id": 12,
            "product": {
                "id": 2,
                "name": "Golf",
                "price": 653.59,
                "number_sold": 0,
                "description": "1994 Volkswagen",
                "quantity": 2,
                "created_date": "2019-07-10",
                "location": "Paris",
                "image_path": "http://localhost:8000/media/products/vehicle.png",
                "average_rating": null,
                "store_id": 1
            }
        }
    ],
    "total_price": 3615.92,
    "size": 4
}

Testing

Run this url in Postman: http://localhost:8000/profile/cart

Related Issues