@feardread/fear 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/controllers/review.js +2 -2
- package/package.json +1 -1
- package/routes/review.js +2 -2
package/controllers/review.js
CHANGED
|
@@ -8,8 +8,8 @@ const Product = require("../models/product");
|
|
|
8
8
|
* @param {Object} res - Express response object
|
|
9
9
|
*/
|
|
10
10
|
exports.review = tryCatch(async (req, res) => {
|
|
11
|
-
const {
|
|
12
|
-
|
|
11
|
+
const { username, email, rating, comment } = req.body;
|
|
12
|
+
const productId = req.params.productId || req.body.productId;
|
|
13
13
|
//const userId = req.user._id;
|
|
14
14
|
|
|
15
15
|
// Validate required fields
|
package/package.json
CHANGED
package/routes/review.js
CHANGED
|
@@ -5,7 +5,7 @@ module.exports = (fear) => {
|
|
|
5
5
|
|
|
6
6
|
router.post("/new", Review.review)
|
|
7
7
|
.get("/rating", Review.rating)
|
|
8
|
-
.get("/by-product/:
|
|
9
|
-
|
|
8
|
+
.get("/by-product/:productId", Review.getProductReviews);
|
|
9
|
+
router.get("/by-product", Review.getProductReviews);
|
|
10
10
|
return router;
|
|
11
11
|
};
|