fix(auth): append user id for session

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-09-04 15:59:05 +08:00
parent 92fed33c56
commit b41a35f675

View File

@@ -239,8 +239,10 @@ export class AuthService {
},
{
projection: {
_id: 0,
access_token: 0,
providerAccountId: 1,
provider: 1,
type: 1,
userId: 1,
},
},
)
@@ -254,7 +256,6 @@ export class AuthService {
},
{
projection: {
_id: 0,
email: 1,
name: 1,
image: 1,
@@ -263,10 +264,13 @@ export class AuthService {
},
)
Object.assign(account, user)
if (user) Object.assign(account, user)
}
return account
return {
...account,
id: account?.userId.toString(),
}
}
getOauthProviders() {
return this.authConfig.providers.map((p) => p.name)