Merged
Conversation
zakkiyyat
requested changes
Mar 7, 2026
Contributor
zakkiyyat
left a comment
There was a problem hiding this comment.
Reviewed the changes and they look good. Once the conflicts are addressed, this can be merged.
Comment on lines
+5
to
+9
| const querySchema = z.object({ | ||
| longitude: z.coerce.number(), | ||
| latitude: z.coerce.number(), | ||
| cursor: z.string().optional(), | ||
| }) |
Contributor
There was a problem hiding this comment.
add strict longitude/latitude range checks ([-180,180], [-90,90]) from query validation, focus on:
- coordinate validation boundaries and malformed query handling
- $geoNear pipeline correctness and distance sorting
- cursor pagination behavior (stability and safety)
- response contract consistency (distanceMeters, cursor nullability)
# Conflicts: # backend/README.md # backend/src/models/food-item.model.ts # backend/src/models/index.ts # backend/src/routes/index.ts
zakkiyyat
approved these changes
Mar 7, 2026
Contributor
zakkiyyat
left a comment
There was a problem hiding this comment.
Thanks for addressing the comments. The changes look good. Approving.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This introduces a location-based discovery feature that allows users to view food items from restaurants physically near them. The goal is to improve relevance in the food discovery experience by prioritizing restaurants within the user’s geographic vicinity. To support this functionality, the Restaurant MongoDB schema has been updated to include a GeoJSON
Pointfield for location data along with a2dsphereindex to enable efficient geospatial queries.A new endpoint,
GET /api/foods/discover, has been implemented to retrieve food items from nearby restaurants based on the user's coordinates. The endpoint acceptslongitude,latitude, andcursoras query parameters. Internally, a MongoDB$geoNearaggregation pipeline is used to fetchFoodItemsbelonging to restaurants located within a defined radius (10km) of the provided coordinates. The results are sorted by proximity so that the closest restaurants appear first.To support scalable browsing, the endpoint implements cursor-based pagination, returning results in batches of 10 items per request. Each response includes the calculated distance between the user and the restaurant, allowing the client application to display proximity information. Query performance is optimized through the use of the
2dsphereindex on the restaurant location field, ensuring efficient geospatial lookups even as the dataset grows.closes #150