Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
taugk committed Dec 16, 2023
1 parent 8f27861 commit 0c6a27b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions routes/postsRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,22 +241,22 @@ router.get("/recommendation/restaurant", async (req, res) => {
const createdAtUnix = moment(post.createdAt).unix();
const updateAtUnix = moment(post.updatedAt).unix();

const responseRestaurantPost = {
const restaurantResponsePost = {
...post.dataValues,
pickupTime: pickupTimeUnix,
createdAt: createdAtUnix,
updatedAt: updateAtUnix,
distance,
};

return responseRestaurantPost;
return restaurantResponsePost;
});

const sortedRestaurants = restaurantWithDistance.sort(
const restaurantSort = restaurantWithDistance.sort(
(a, b) => a.distance - b.distance
);

const restaurantPost = sortedRestaurants.slice(0, 5);
const restaurantPost = restaurantSort.slice(0, 5);
res.status(200).json({ restaurants: restaurantPost });
} catch (error) {
console.error("Error fetching nearby restaurant recommendations", error);
Expand Down

0 comments on commit 0c6a27b

Please sign in to comment.