add project in the token

This commit is contained in:
faris Aljohari
2025-03-20 09:42:28 +03:00
parent 670c026cfd
commit b5469cb316
5 changed files with 6 additions and 1 deletions

View File

@ -5,4 +5,5 @@ export class AuthInterface {
sessionId: string;
id: number;
role?: object;
project?: object;
}

View File

@ -38,7 +38,7 @@ export class AuthService {
email,
region: regionUuid ? { uuid: regionUuid } : undefined,
},
relations: ['roleType'],
relations: ['roleType', 'project'],
});
if (
platform === PlatformType.WEB &&
@ -105,6 +105,7 @@ export class AuthService {
googleCode: user.googleCode,
hasAcceptedWebAgreement: user.hasAcceptedWebAgreement,
hasAcceptedAppAgreement: user.hasAcceptedAppAgreement,
project: user?.project,
};
if (payload.googleCode) {
const profile = await this.getProfile(payload.googleCode);

View File

@ -32,6 +32,7 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
uuid: payload.uuid,
sessionId: payload.sessionId,
role: payload?.role,
project: payload?.project,
};
} else {
throw new BadRequestException('Unauthorized');

View File

@ -35,6 +35,7 @@ export class RefreshTokenStrategy extends PassportStrategy(
uuid: payload.uuid,
sessionId: payload.sessionId,
role: payload?.role,
project: payload?.project,
};
} else {
throw new BadRequestException('Unauthorized');