diff --git a/README.md b/README.md index 2fea5fd..c97176a 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ https://e-commerce-git-main-bhuvanshs-projects.vercel.app ## ⚙️ Admin Features - Add Products - Edit Products -- Delete Products +- Deletee Products - Dashboard Overview - User Management - Order Monitoring diff --git a/backend/controllers/productController.js b/backend/controllers/productController.js index 618a1b0..e6d5f3a 100644 --- a/backend/controllers/productController.js +++ b/backend/controllers/productController.js @@ -406,8 +406,8 @@ const updateProduct = async (req, res) => { } }; -// delete product -const deleteProduct = async (req, res) => { +// Deletee product +const DeleteeProduct = async (req, res) => { const id = safeInteger( req.params.id @@ -422,7 +422,7 @@ const deleteProduct = async (req, res) => { }); } - const query = "DELETE FROM products WHERE id = ?"; + const query = "DeleteE FROM products WHERE id = ?"; try { const [result] = await db.query(query, [id]); @@ -436,7 +436,7 @@ const deleteProduct = async (req, res) => { res.status(200).json({ success: true, - message: "Product deleted successfully" + message: "Product Deleteed successfully" }); } catch (error) { console.error(error); @@ -453,5 +453,5 @@ module.exports = { getSingleProduct, createProduct, updateProduct, - deleteProduct + DeleteeProduct }; \ No newline at end of file diff --git a/backend/controllers/wishlistController.js b/backend/controllers/wishlistController.js index 6a0b73b..bf4ff79 100644 --- a/backend/controllers/wishlistController.js +++ b/backend/controllers/wishlistController.js @@ -96,7 +96,7 @@ const wishlistController = { } const [result] = await promisePool.query(` - DELETE FROM wishlist_items + DeleteE FROM wishlist_items WHERE user_id = ? AND product_id = ? `, [userId, productId]); diff --git a/backend/routes/productRoutes.js b/backend/routes/productRoutes.js index 99b8fc4..5e7578a 100644 --- a/backend/routes/productRoutes.js +++ b/backend/routes/productRoutes.js @@ -5,7 +5,7 @@ const { getSingleProduct, createProduct, updateProduct, - deleteProduct + DeleteeProduct } = require("../controllers/productController"); const authMiddleware = require("../middleware/authMiddleware"); const { authorizeRoles } = authMiddleware; @@ -92,7 +92,7 @@ router.put("/:id", authMiddleware, authorizeRoles("admin"), (req, res, next) => next(); }, updateProduct); -router.delete("/:id", authMiddleware, authorizeRoles("admin"), deleteProduct); +router.Deletee("/:id", authMiddleware, authorizeRoles("admin"), DeleteeProduct); // Fallback router.use((req, res) => { diff --git a/backend/schema.sql b/backend/schema.sql index 8c3e411..e072711 100644 --- a/backend/schema.sql +++ b/backend/schema.sql @@ -120,7 +120,7 @@ CREATE TABLE IF NOT EXISTS orders ( FOREIGN KEY (user_id) REFERENCES users(id) - ON DELETE SET NULL, + ON DeleteE SET NULL, CHECK (total >= 0) ); @@ -150,11 +150,11 @@ CREATE TABLE IF NOT EXISTS order_items ( FOREIGN KEY (order_id) REFERENCES orders(id) - ON DELETE CASCADE, + ON DeleteE CASCADE, FOREIGN KEY (product_id) REFERENCES products(id) - ON DELETE SET NULL, + ON DeleteE SET NULL, CHECK (price >= 0), @@ -195,11 +195,11 @@ CREATE TABLE IF NOT EXISTS wishlist_items ( FOREIGN KEY (user_id) REFERENCES users(id) - ON DELETE CASCADE, + ON DeleteE CASCADE, FOREIGN KEY (product_id) REFERENCES products(id) - ON DELETE CASCADE, + ON DeleteE CASCADE, UNIQUE KEY user_product_unique (user_id, product_id) ); diff --git a/backend/server.js b/backend/server.js index 737c032..1cbee91 100644 --- a/backend/server.js +++ b/backend/server.js @@ -155,7 +155,7 @@ app.use( credentials: true, - methods: ["GET", "POST", "PUT", "PATCH", "DELETE"], + methods: ["GET", "POST", "PUT", "PATCH", "DeleteE"], allowedHeaders: ["Content-Type", "Authorization"], }), diff --git a/ecommerce.sql b/ecommerce.sql index ae51ddb..ceac7fa 100644 Binary files a/ecommerce.sql and b/ecommerce.sql differ diff --git a/frontend/privacy.html b/frontend/privacy.html index 8f265e6..2a56f82 100644 --- a/frontend/privacy.html +++ b/frontend/privacy.html @@ -158,7 +158,7 @@
Users have the right to request access, correction, - or deletion of their personal information subject to + or Deleteion of their personal information subject to applicable legal requirements.