Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions backend/controllers/productController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]);
Expand All @@ -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);
Expand All @@ -453,5 +453,5 @@ module.exports = {
getSingleProduct,
createProduct,
updateProduct,
deleteProduct
DeleteeProduct
};
2 changes: 1 addition & 1 deletion backend/controllers/wishlistController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down
4 changes: 2 additions & 2 deletions backend/routes/productRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const {
getSingleProduct,
createProduct,
updateProduct,
deleteProduct
DeleteeProduct
} = require("../controllers/productController");
const authMiddleware = require("../middleware/authMiddleware");
const { authorizeRoles } = authMiddleware;
Expand Down Expand Up @@ -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) => {
Expand Down
10 changes: 5 additions & 5 deletions backend/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
Expand Down Expand Up @@ -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),

Expand Down Expand Up @@ -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)
);
Expand Down
2 changes: 1 addition & 1 deletion backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ app.use(

credentials: true,

methods: ["GET", "POST", "PUT", "PATCH", "DELETE"],
methods: ["GET", "POST", "PUT", "PATCH", "DeleteE"],

allowedHeaders: ["Content-Type", "Authorization"],
}),
Expand Down
Binary file modified ecommerce.sql
Binary file not shown.
2 changes: 1 addition & 1 deletion frontend/privacy.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ <h3>
</h3>
<p>
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.
</p>
<h3>
Expand Down
24 changes: 12 additions & 12 deletions frontend/scripts/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,9 @@ function renderProducts() {

<button
type="button"
class="action-btn delete-btn"
class="action-btn Deletee-btn"
>
Delete
Deletee
</button>
</td>
`;
Expand All @@ -603,12 +603,12 @@ function renderProducts() {
);

row.querySelector(
".delete-btn"
".Deletee-btn"
)?.addEventListener(
"click",
() => {

deleteProduct(
DeleteeProduct(
product.id
);
}
Expand All @@ -625,14 +625,14 @@ function renderProducts() {
);
}

// delete product
async function deleteProduct(
// Deletee product
async function DeleteeProduct(
id
) {

const confirmed =
confirm(
"Delete this product permanently?"
"Deletee this product permanently?"
);

if (
Expand All @@ -649,7 +649,7 @@ async function deleteProduct(
`/products/${id}`,
{
method:
"DELETE"
"DeleteE"
}
);

Expand All @@ -674,7 +674,7 @@ async function deleteProduct(
renderStats();

AppUtils.notify(
"Product deleted successfully!",
"Product Deleteed successfully!",
"success"
);

Expand All @@ -683,20 +683,20 @@ async function deleteProduct(
AppUtils.notify(
response.message
||
"Failed to delete product.",
"Failed to Deletee product.",
"error"
);
}

} catch (error) {

console.error(
"DELETE PRODUCT ERROR:",
"DeleteE PRODUCT ERROR:",
error
);

AppUtils.notify(
"Failed to delete product.",
"Failed to Deletee product.",
"error"
);
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/scripts/product-variants.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function setupVariants(
productVariants
).forEach(
(key) => {
delete productVariants[
Deletee productVariants[
key
];
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/styles/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ table td{
color: #fff;
}

.delete-btn{
.Deletee-btn{
background: red;
}

Expand Down
4 changes: 4 additions & 0 deletions frontend/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,7 @@ homepage product grid fix
max-width: 100%;
}
}

/* =============================
Password Strength Meter (Issue #166)
}