acmpesuecc / menumemory-backend

Other
0 stars 5 forks source link

Create POST /visits endpoint #4

Open Smuzzy-waiii opened 1 month ago

Smuzzy-waiii commented 1 month 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. Note that an empty list can be passed for the orders attribute in which only the visit shall be created in the DB but no order shall be created.

The request body for this endpoint will look as follows:

{
    "user_id": 1,
    "restaurant_id": 23086,
    "date": "2024-10-17",
    "time": "18:24:00",
    "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 create a unit test for the above endpoint in main_test.go update the openapi.yaml to document the above changes!

bunsamosa-bot[bot] commented 1 month ago

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

PandaTGOS commented 1 month ago

Heyy can I be assigned to this

Smuzzy-waiii commented 1 month ago

!assign @PandaTGOS 60