@@ -7,6 +7,9 @@ import * as bcrypt from 'bcrypt';
77import { RedisService } from '../common/services/redis.service' ;
88import { v4 as uuidv4 } from 'uuid' ;
99import { StructuredLoggerService } from '../common/logging/logger.service' ;
10+ import { AuthUser , JwtPayload , AuthTokens } from './auth.types' ;
11+ import { PrismaUser } from '../types/prisma.types' ;
12+ import { isObject , isString } from '../types/guards' ;
1013
1114@Injectable ( )
1215export class AuthService {
@@ -28,8 +31,9 @@ export class AuthService {
2831 return {
2932 message : 'User registered successfully. Please check your email for verification.' ,
3033 } ;
31- } catch ( error ) {
32- this . logger . error ( 'User registration failed' , error . stack , {
34+ } catch ( error : unknown ) {
35+ const errorMessage = error instanceof Error ? error . message : 'Unknown error occurred' ;
36+ this . logger . error ( 'User registration failed' , errorMessage , {
3337 email : createUserDto . email ,
3438 } ) ;
3539 throw error ;
@@ -81,8 +85,9 @@ export class AuthService {
8185
8286 this . logger . logAuth ( 'User login successful' , { userId : user . id } ) ;
8387 return this . generateTokens ( user ) ;
84- } catch ( error ) {
85- this . logger . error ( 'User login failed' , error . stack , {
88+ } catch ( error : unknown ) {
89+ const errorMessage = error instanceof Error ? error . message : 'Unknown error occurred' ;
90+ this . logger . error ( 'User login failed' , errorMessage , {
8691 email : credentials . email ,
8792 } ) ;
8893 throw error ;
0 commit comments