Skip to content

Restaurant searching by criteria and returning details with restaurant ID - #40

Merged
sonoftirit merged 5 commits into
mainfrom
restaurant-searching-and-details
Oct 16, 2026
Merged

sonoftirit merged 5 commits into
mainfrom
restaurant-searching-and-details

Conversation

@CookieLynx

Copy link
Copy Markdown
Collaborator

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=Starbucks OR restaurants?name=burger&hasMenu=true&sort_by=name&sort_desc=true
Added route for getting a specific restaurant by its ID /restaurant/{restaurant_id} returning only that restaurants information
Example: restaurant/NwYJoaOHusWdiqXpM7mQH for 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

@sonoftirit sonoftirit left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 CookieLynx left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@CookieLynx
CookieLynx requested a review from sonoftirit October 16, 2026 07:43

@sonoftirit sonoftirit left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sonoftirit
sonoftirit merged commit 02ff906 into main Oct 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[USER STORY] [US 1.2 Filtering Restaurants]

2 participants