From 65859c1fb3ff6828f5690168101d681829c65780 Mon Sep 17 00:00:00 2001 From: Moaid Hashem Date: Tue, 15 Oct 2024 10:14:36 +0300 Subject: [PATCH] -Fixing Bugs --- controllers/handelUser.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/controllers/handelUser.js b/controllers/handelUser.js index 82fe624..ed24f15 100644 --- a/controllers/handelUser.js +++ b/controllers/handelUser.js @@ -39,19 +39,17 @@ const updateOne = async (req, res) => { const { id } = req.params; const { newPassword, ...newUpdate } = req.body; // Extract other fields from req.body const updateData = { ...newUpdate }; - + console.log(req.body) // Handle password hashing if provided if (newPassword) { const hashedPassword = await bcrypt.hash(newPassword, 10); updateData.password = hashedPassword; } - // If an image is provided, handle file upload if (req.file) { updateData.image = req.file.path; // Set image path from multer file upload } - // Find the user and update const updatedUser = await usermodel.findByIdAndUpdate(id, updateData, { new: true }); if (!updatedUser) {