History (add/ remove) favorites add remove done

This commit is contained in:
Mann Patel
2025-04-13 12:52:21 -06:00
parent 3bdb8877a6
commit 2ef05ac3af
9 changed files with 220 additions and 92 deletions

View File

@@ -1,8 +1,14 @@
// routes/product.js
const express = require("express");
const { HistoryByUserId } = require("../controllers/history");
const {
HistoryByUserId,
DelHistory,
AddHistory,
} = require("../controllers/history");
const router = express.Router();
router.post("/getHistory", HistoryByUserId);
router.post("/delHistory", DelHistory);
router.post("/addHistory", AddHistory);
module.exports = router;

View File

@@ -3,6 +3,7 @@ const express = require("express");
const {
addFavorite,
getFavorites,
removeFavorite,
getAllProducts,
getProductById,
} = require("../controllers/product");
@@ -16,6 +17,7 @@ router.use((req, res, next) => {
router.post("/addFavorite", addFavorite);
router.post("/getFavorites", getFavorites);
router.post("/delFavorite", removeFavorite);
router.get("/getProduct", getAllProducts);
router.get("/:id", getProductById); // Simplified route