diff --git a/src/api/review-application/reviewApplication.service.ts b/src/api/review-application/reviewApplication.service.ts index 74e005c..87f4ab2 100644 --- a/src/api/review-application/reviewApplication.service.ts +++ b/src/api/review-application/reviewApplication.service.ts @@ -42,7 +42,7 @@ export class ReviewApplicationService { authUser: JwtUser, dto: CreateReviewApplicationDto, ): Promise { - const userId = authUser.userId as string; + const userId = String(authUser.userId); const handle = authUser.handle as string; try { diff --git a/src/shared/modules/global/jwt.service.ts b/src/shared/modules/global/jwt.service.ts index 2f9898c..27a6363 100644 --- a/src/shared/modules/global/jwt.service.ts +++ b/src/shared/modules/global/jwt.service.ts @@ -46,8 +46,8 @@ export class JwtService implements OnModuleInit { try { // Use tc-core-library-js for JWT validation const payload = await new Promise((resolve, reject) => { - // Create a mock request object with the authorization header - const mockReq = { + // Create a request object with the authorization header + const req = { headers: { authorization: token.startsWith('Bearer ') ? token @@ -55,7 +55,7 @@ export class JwtService implements OnModuleInit { }, }; - const mockRes = {}; + const res = {}; const next = (error?: any) => { if (error) { @@ -64,7 +64,7 @@ export class JwtService implements OnModuleInit { } // tc-core-library-js should have attached authUser to the request - const authUser = (mockReq as any).authUser; + const authUser = (req as any).authUser; if (!authUser) { return reject(new UnauthorizedException('Invalid token')); @@ -74,7 +74,7 @@ export class JwtService implements OnModuleInit { }; // Call the tc-core-library-js authenticator - this.jwtAuthenticator(mockReq, mockRes, next); + this.jwtAuthenticator(req, res, next); }); console.log(`Decoded token: ${JSON.stringify(payload)}`);