FIX: getAllUsers logic
This commit is contained in:
@@ -94,14 +94,13 @@ const loginUser = async (email, password) => {
|
|||||||
throw new AppError('IncorrectEmailOrPassword', 401, {})
|
throw new AppError('IncorrectEmailOrPassword', 401, {})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set user password to undefined before sending data
|
||||||
|
user.password = undefined
|
||||||
return { token: signToken(user._id), user }
|
return { token: signToken(user._id), user }
|
||||||
}
|
}
|
||||||
|
|
||||||
const getAllUsers = async () => {
|
const getAllUsers = async () => {
|
||||||
const users = await User.find({}, null, null)
|
const users = await User.find({}, null, null)
|
||||||
for (let user of users) {
|
|
||||||
user.activatedCodes = await codeService.getCodeCount(user._id)
|
|
||||||
}
|
|
||||||
|
|
||||||
return users
|
return users
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user