Open humayuntariq98 opened 1 year ago
Great work with the logic here! 💯 Integrating Google's API within a week and also making sure to update a destination's image is an excellent achievement!
Axios request syntax is readable.
Great work with supplying params
and drilling into data response.data.results[0].photos
Great work using splice()
and save()
!
Instructional Glow: README, styling, functionality, great work with location images/API! Code is organized.
Grow 1 - If we update a destination, the image also gets updated through Google API
async function update(req, res) { try { const destinationData = { ...req.body }; const editedDestination = await Destination.findById(req.params.id); editedDestination.name = destinationData.name; editedDestination.favoriteSpots = destinationData.favoriteSpots; editedDestination.budget = destinationData.budget;
}
Grow 2 - Being able to only update and remove our own reviews
async function removeReview(req, res) { try { const { destinationId, reviewId } = req.params; // Find the destination const destinationFound = await Destination.findOne({ "reviews._id": reviewId, "reviews.user": req.user._id, });
}