selling Pg UI and Fav is done

This commit is contained in:
Mann Patel
2025-04-12 18:33:13 -06:00
parent 0f8bb622a4
commit 814c24c83f
5 changed files with 425 additions and 66 deletions

View File

@@ -1,13 +1,13 @@
const db = require("../utils/database");
exports.addFavorite = async (req, res) => {
const { userID, productsID } = req.body;
const { userID, productID } = req.body;
console.log(userID);
try {
// Use parameterized query to prevent SQL injection
const [result] = await db.execute(
"INSERT INTO Favorites (UserID, ProductID) VALUES (?, ?)",
[userID, productsID],
`INSERT INTO Favorites (UserID, ProductID) VALUES (?, ?)`,
[userID, productID],
);
res.json({