feat(auth): add user and role management

This commit is contained in:
Ali BARIN
2023-07-18 21:00:10 +00:00
parent b581f539e2
commit 9e64af4793
68 changed files with 1970 additions and 156 deletions

View File

@@ -15,10 +15,12 @@ const isAuthenticated = rule()(async (_parent, _args, req) => {
req.currentUser = await User
.query()
.findById(userId)
.joinRelated({
.leftJoinRelated({
role: true,
permissions: true,
})
.withGraphFetched({
role: true,
permissions: true,
});
@@ -38,9 +40,9 @@ const authentication = shield(
},
Mutation: {
'*': isAuthenticated,
login: allow,
createUser: allow,
registerUser: allow,
forgotPassword: allow,
login: allow,
resetPassword: allow,
},
},