nss-evening-cohort-12 / bangazon-api-medlenmage

bangazon-api-medlenmage created by GitHub Classroom
0 stars 1 forks source link

Jm product likes #40

Closed medlenmage closed 3 years ago

medlenmage commented 3 years ago

Creates the ability to like and dislike a product as well as retrieve a list of liked products

Changes

Request

POST /products/id:/like Likes a product

Response

HTTP/1.1 201 OK

{
    "id": 4,
    "product": {
        "id": 3,
        "deleted": null,
        "name": "Durango",
        "price": 541.17,
        "description": "1998 Dodge",
        "quantity": 2,
        "created_date": "2019-05-16",
        "location": "Górki Wielkie",
        "image_path": null,
        "customer": {
            "id": 6,
            "phone_number": "555-1212",
            "address": "100 Dauntless Way",
            "user": 7
        },
        "category": {
            "id": 2,
            "name": "Auto"
        }
    }
}

Request

DELETE/products/id:/like dislikes/unlikes a product

Response

HTTP/1.1 204 NO CONTENT

{ }

Request

GET /products/liked gets liked products

Response

HTTP/1.1 200 OK

    {
        "id": 2,
        "product": {
            "id": 2,
            "deleted": null,
            "name": "Golf",
            "price": 653.59,
            "description": "1994 Volkswagen",
            "quantity": 4,
            "created_date": "2019-07-10",
            "location": "Zhongshan",
            "image_path": null,
            "customer": {
                "id": 4,
                "phone_number": "555-1212",
                "address": "100 Infinity Way",
                "user": 5
            },
            "category": {
                "id": 2,
                "name": "Auto"
            }
        }
    }

Testing

Description of how to test code...

Related Issues