mirror of
https://github.com/kevin-DL/complete-node-bootcamp.git
synced 2026-01-16 13:14:35 +00:00
Initial commit 🚀
This commit is contained in:
16
4-natours/after-section-14/controllers/reviewController.js
Normal file
16
4-natours/after-section-14/controllers/reviewController.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const Review = require('./../models/reviewModel');
|
||||
const factory = require('./handlerFactory');
|
||||
// const catchAsync = require('./../utils/catchAsync');
|
||||
|
||||
exports.setTourUserIds = (req, res, next) => {
|
||||
// Allow nested routes
|
||||
if (!req.body.tour) req.body.tour = req.params.tourId;
|
||||
if (!req.body.user) req.body.user = req.user.id;
|
||||
next();
|
||||
};
|
||||
|
||||
exports.getAllReviews = factory.getAll(Review);
|
||||
exports.getReview = factory.getOne(Review);
|
||||
exports.createReview = factory.createOne(Review);
|
||||
exports.updateReview = factory.updateOne(Review);
|
||||
exports.deleteReview = factory.deleteOne(Review);
|
||||
Reference in New Issue
Block a user