acmpesuecc / menumemory-backend

Other
0 stars 0 forks source link

Create GET /visits endpoint #5

Open Smuzzy-waiii opened 3 hours ago

Smuzzy-waiii commented 3 hours ago

Create GET /visits endpoint which takes in a required user_id query param and returns all the visits for that user sorted in descending order of date and time. It also takes an optional restaurant_id query param which filters the above results to only include the results from a particular restaurant.

The json response shoudl have the following format:

{
  "visits": [
    {
      "id": 1,
      "user_id": 1,
      "restaurant_info": {
        "id": 23086,
        "name": "Milano Pizza",
        "area": "Jayanagar",
        "address": "foobar",
        "maps_link": "https://blahblah",
        "maps_rating_out_of_5": 3.7
      },
      "date": "2024-10-17",
      "time": "<choose format that you like>",
      "orders": [
        {
          "id": 1,
          "dish_info": {
            "id": 1,
            "name": "Margherita Pizza with Sundried Tomatoes"
          },
          "rating": 4.7,
          "review_text": "The best pizza ever!"
        },
        ...
      ]
    }
  ],
  ...
}

You may use user_id 1 for which a user already exists in the DB for testing.

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

bunsamosa-bot[bot] commented 3 hours ago

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