acmpesuecc / menumemory-backend

Other
0 stars 5 forks source link

Create a POST /orders endpoint #7

Open Smuzzy-waiii opened 2 weeks ago

Smuzzy-waiii commented 2 weeks ago

Create a POST /orders endpoint to create a new order. This is useful to add orders to a preexisting visit.

The request body will look as follows:

{
  "visit_id": 1,
  "dish_id": 1,
  "rating": 4.9,
  "review_text": "Best food ever"
}

Take in user_id as a required query param (This will be swapped out for API authentication later). Check if the visit_id to which this order is being posted to does infact belong to the given user_id. If it does not, return a 403 Unauthorized error. If it does, process the request normally. You may use user_id 1 for which a user 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 2 weeks ago

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