<commit_before>var Review = require('../reviews/reviewModel.js');

module.exports = {
  postReview: function (req, res, next) {
  },

  getReviews: function (req, res, next) {
    var id = req.params.id;
    Review.find({movie: id})
      .sort({date: -1})
      .exec(function(err, review) {
        if (err) {
          console.log(err);
        } else {
          res.send(review);
        }
      });
  },

  deleteReview: function (req, res, next) {

  },

  editReview: function (req, res, next) {

  },

  editCount: function (req, res, next) {

  }

};<commit_msg>Added delete review method<commit_after>var Review = require('../reviews/reviewModel.js');

module.exports = {
  postReview: function (req, res, next) {
    var data = req.body;
    var review = new Review({
      username: data.username,
      movie: data.movie,
      title: data.title,
      date: new Date(),
      review: data.review,
      rating: data.rating,
      voteCount: 0
    });
    review.save(function (err, revObj) {
      if (err) {
        console.log(err);
        res.send(404);
      } else {
        console.log('Saved');
        res.send(201);
      }
    });
  },

  getReviews: function (req, res, next) {
    var id = req.params.id;
    Review.find({movie: id})
      .sort({date: -1})
      .exec(function(err, review) {
        if (err) {
          console.log(err);
        } else {
          res.send(review);
        }
      });
  },

  deleteReview: function (req, res, next) {
    var id = req.params.reviewId;
    Review.find({ id: id })
      .remove()
      .exec(function (err, data) {
        if (err) {
          res.send(404);
        } else {
          res.send(200);
        }
      });
  },

  editReview: function (req, res, next) {

  },

  editCount: function (req, res, next) {

  }

};
{'fraction_non_alphanumeric': 0.1627006087437742, 'fraction_numerical': 0.008301051466519093, 'mean_word_length': 1.9208400646203554, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6419391', 'n_tokens_mistral': 630, 'n_tokens_neox': 604, 'n_words': 136}