Minor refactoring in DB modules for readability
This commit is contained in:
1 parent
568372f54d
commit
e36abfb9df
3 files changed
+28
-29
No files matched your search
@@ -70,11 +70,10 @@ const getUserByEmail = async (email) => {
|
||||
// Need the password to be able to compare, removed .select()
|
||||
// We can strip the hash before returning the user
|
||||
const user = await UserModel.findOne({ email: email }).select("-profileImage");
|
||||
if (user) {
|
||||
return user;
|
||||
} else {
|
||||
if (!user) {
|
||||
throw new Error(errorMessages.DB_USER_NOT_FOUND);
|
||||
}
|
||||
return user;
|
||||
} catch (error) {
|
||||
error.service = SERVICE_NAME;
|
||||
error.method = "getUserByEmail";
|
||||
|
||||
Reference in new issue
Block a user