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:
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!
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:
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 useuser_id
=1
which is a test user which already exists in the DB for testing the endpointPlease remember to create a unit test for the above endpoint in
main_test.go
update theopenapi.yaml
to document the above changes!