Merge branch 'bluewave-labs:master' into backend-completion

This commit is contained in:
Mohammad Khalilzadeh authored and GitHub committed 2024-07-04 11:18:30 +03:30
commit a2e378f1dd
13 files changed
+240 -53

No files matched your search

+7 -3
View File
@@ -56,7 +56,11 @@ const registerController = async (req, res, next) => {
service: SERVICE_NAME,
userId: newUser._id,
});
const token = issueToken(newUser._doc);
const userForToken = { ...newUser._doc };
delete userForToken.profileImage;
const token = issueToken(userForToken);
// Sending email to user with pre defined template
const template = registerTemplate("https://www.bluewavelabs.ca");
@@ -70,7 +74,7 @@ const registerController = async (req, res, next) => {
return res.status(200).json({
success: true,
msg: successMessages.AUTH_CREATE_USER,
data: token,
data: { user: newUser, token: token },
});
} catch (error) {
error.service = SERVICE_NAME;
@@ -109,7 +113,7 @@ const loginController = async (req, res, next) => {
return res.status(200).json({
success: true,
msg: successMessages.AUTH_LOGIN_USER,
data: token,
data: { user: userWithoutPassword, token: token },
});
} catch (error) {
error.status = 500;