acmpesuecc / menumemory-backend

Other
0 stars 0 forks source link

Create POST /visits endpoint #4

Open Smuzzy-waiii opened 4 hours ago

Smuzzy-waiii commented 4 hours ago

Create POST /visits endpoint which creates a row in the Visit table for the actual visit and also rows in the Order table for all the dishes ordered during the visit along with their rating, review etc.

The request body for this endpoint will look as follows:

{
    "user_id": 1,
    "restaurant_id": 23086,
    "date": "2024-10-17",
    "time": "<choose format that you like>",
    "orders": [
        {
            "dishId": 1,
            "rating": 4.7,
            "review_text": "The best pizza ever!"
        },
        ...
    ]
}

This takes in a user_id for which the visit has to be created. This is okay for now and will be replaced by an actual API auth mechanism later. You may use user_id=1 which is a test user which already exists in the DB for testing the endpoint

Please remember to update the openapi.yaml and openapi.json files to document the above changes!

bunsamosa-bot[bot] commented 4 hours ago

Thank you for opening this issue! A Maintainer will review it soon!