Repository navigation
Restaurant searching by criteria and returning details with restaurant ID - #40
Conversation
sonoftirit
left a comment
There was a problem hiding this comment.
Nice work, the search and the 404 for a missing ID work well and the tests are good. A few things:
- sort_by=hasMenu returns a 500 because Python can't sort menu objects. Maybe only allow certain fields like name and return a 422 for anything else? Right now an unknown sort_by just gets ignored.
- Can we make it /restaurants/{id} instead of /restaurant/{id}? The list is plural and my update endpoint will be PATCH /restaurants/{id}, so it'd be consistent.
- GitHub only linked #26 from the description. It needs the keyword before each one, like "Resolves #16, Resolves #17".
- The README row for the query got cut off at the end.
- Heads up, this conflicts with Casey's #39 in the repository and service files, so whoever merges second will need to sort that out.
…ds, changed restaurant endpoint to restaurants
CookieLynx
left a comment
There was a problem hiding this comment.
Fixed sort_by=hasMenu to actually sort by has menu first, now an unknown sort_by= such as sort_by=hnbcjdsf returns 400 with information on how to use each parameter.
Renamed /restaurant/{id} to restaurants/{id} to be consistent with other endpoints
README has been fixed to show full query
Implemented new tests to test invalid sort_by and fixed issue with model_construct inside test_restaurant_service
Resolves #26
Resolves #16
Resolves #17
Resolves #36
Resolves #18
Resolves #19
…eing 1 the order was inverted
sonoftirit
left a comment
There was a problem hiding this comment.
Thanks for the fixes, sort_by and the /restaurants/{id} rename look good and the new tests cover it. Approving. One small thing: the Resolves list is in a comment, so GitHub only linked #26. If you move it into the PR description, all the issues will close when it merges.
Implementation of searching restaurants and getting specific one by ID
Added route for searching restaurants using
restaurants?{query}with searching criteria returning only restaurants that match the search. Example:restaurants?name=StarbucksORrestaurants?name=burger&hasMenu=true&sort_by=name&sort_desc=trueAdded route for getting a specific restaurant by its ID
/restaurant/{restaurant_id}returning only that restaurants informationExample:
restaurant/NwYJoaOHusWdiqXpM7mQHfor the first Starbucks in our sample data.Implemented restaurant query schema that includes the sorting criteria the user can use to search restaurants, its currently just by name, hasMenu, and what to sort by and then sorting by ascending or descending order.
Edited the restaurant schema to make the menu an optional component for restaurant that don't currently have any menu items .
Modified routes to include the new Restaurant query and endpoint for
/restaurant/{restaurant_id}.Modified restaurant repository to find restaurant by ID.
Modified restaurant service to include logic for sorting the list and only returning ones that match searching criteria.
Implemented tests for getting specific restaurant by ID in endpoint and repository.
Implemented tests for sorting restaurants by criteria in endpoint and service.
Added new endpoints to README.
Resolves #26 #16 #17 #36 #18 #19