text: const { Rental } = require('../models/rental');
  const { Movie } = require('../models/movie');
  
  module.exports = async (req, res) => {
      const rental = await Rental.lookup(req.body.customerId, req.body.movieId);
  
      if (!rental) return res.status(404).send('Rental not found.');
  
      if (rental.dateReturned) return res.status(400).send('Return already processed.');
  
      rental.return();
      await rental.save();
  
      // eslint-disable-next-line no-underscore-dangle
      await Movie.update({ _id: rental.movie._id }, {
          $inc: { numberInStock: 1 },
      });
  
      return res.send(rental);
  };
  