diff --git a/libs/common/src/auth/interfaces/auth.interface.ts b/libs/common/src/auth/interfaces/auth.interface.ts index ba674ee..15fcec8 100644 --- a/libs/common/src/auth/interfaces/auth.interface.ts +++ b/libs/common/src/auth/interfaces/auth.interface.ts @@ -5,4 +5,5 @@ export class AuthInterface { sessionId: string; id: number; role?: object; + project?: object; } diff --git a/libs/common/src/auth/services/auth.service.ts b/libs/common/src/auth/services/auth.service.ts index fdba2f0..c424522 100644 --- a/libs/common/src/auth/services/auth.service.ts +++ b/libs/common/src/auth/services/auth.service.ts @@ -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); diff --git a/libs/common/src/auth/strategies/jwt.strategy.ts b/libs/common/src/auth/strategies/jwt.strategy.ts index 88ecb99..2154fb4 100644 --- a/libs/common/src/auth/strategies/jwt.strategy.ts +++ b/libs/common/src/auth/strategies/jwt.strategy.ts @@ -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'); diff --git a/libs/common/src/auth/strategies/refresh-token.strategy.ts b/libs/common/src/auth/strategies/refresh-token.strategy.ts index 6061bd2..e17f480 100644 --- a/libs/common/src/auth/strategies/refresh-token.strategy.ts +++ b/libs/common/src/auth/strategies/refresh-token.strategy.ts @@ -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'); diff --git a/src/auth/services/user-auth.service.ts b/src/auth/services/user-auth.service.ts index c3939c2..e4a6551 100644 --- a/src/auth/services/user-auth.service.ts +++ b/src/auth/services/user-auth.service.ts @@ -160,6 +160,7 @@ export class UserAuthService { role: user.roleType, hasAcceptedWebAgreement: user.hasAcceptedWebAgreement, hasAcceptedAppAgreement: user.hasAcceptedAppAgreement, + project: user.project, sessionId: session[1].uuid, }); return res;