Added image bytes to update user profile

This commit is contained in:
Alex Holliday committed 2024-07-03 10:23:16 -07:00
1 parent 9532fa6fb5
commit da1e8ee5d9
3 files changed
+15 -3

No files matched your search

+8 -1
View File
@@ -88,9 +88,16 @@ const getUserByEmail = async (req, res) => {
const updateUser = async (req, res) => {
const candidateUserId = req.params.userId;
const candidateUser = req.body;
try {
const candidateUser = { ...req.body };
if (req.file) {
candidateUser.profileImage = {
data: req.file.buffer,
contentType: req.file.mimetype,
};
}
const updatedUser = await UserModel.findByIdAndUpdate(
candidateUserId,
candidateUser,