acmpesuecc / menumemory-backend

Other
0 stars 0 forks source link

Create PUT /visits/<visit_id> endpoint #10

Open Smuzzy-waiii opened 3 hours ago

Smuzzy-waiii commented 3 hours ago

Create PUT /visits/ endpoint which allows to update a existing visit. is a path param which specifies the id of the visit to update. Only updating the date, time and restaurant_id is allowed. Updating the user_id is not allowed. The request body follows the following format:

{
  "date": "2021-10-17",
  "time": "18:24:00",
  "restaurant_id": 1
}

Take in user_id as a required query param (This will be swapped out for API authentication later). Check if the visit_id passed in 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 3 hours ago

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