Decoupled JWT from DB
This commit is contained in:
1 parent
14f6f05dfc
commit
0cc7751d2e
5 files changed
+16
-7
No files matched your search
@@ -150,10 +150,20 @@ const getAllUsers = async (req, res) => {
|
||||
}
|
||||
};
|
||||
|
||||
const logoutUser = async (userId) => {
|
||||
try {
|
||||
await UserModel.updateOne({ _id: userId }, { $unset: { authToken: null } });
|
||||
return true;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
insertUser,
|
||||
getUserByEmail,
|
||||
updateUser,
|
||||
deleteUser,
|
||||
getAllUsers,
|
||||
logoutUser,
|
||||
};
|
||||
Reference in new issue
Block a user