text: const Hike = require('../models/hike');
  const Review = require('../models/review');
  
  module.exports.createReview = async (req, res) => {
      console.log("Creating review ...")
      const hike = await Hike.findById(req.params.id);
      const review = new Review(req.body.review);
  
      review.owner = req.user._id;
      review.date = new Date();
      hike.reviews.push(review);
  
      await review.save();
      await hike.save();
      
      console.log("Review has been added")
      res.redirect(`/places/${hike._id}`);
  }
  
  module.exports.deleteReview = async (req, res) => {
      console.log("Deleting review ...")
      const { id, reviewId } = req.params;
  
      await Hike.findByIdAndUpdate(id, { $pull: { reviews: reviewId } });
      await Review.findByIdAndDelete(reviewId);
  
      console.log("Review has been deleted")
      res.redirect(`/places/${id}`);
  }