@@ -176,7 +176,7 @@ export class AuthService {
176176 }
177177 }
178178 }
179-
179+
180180 // Remove refresh token
181181 await this . redisService . del ( `refresh_token:${ userId } ` ) ;
182182 this . logger . logAuth ( 'User logged out successfully' , { userId } ) ;
@@ -251,14 +251,14 @@ export class AuthService {
251251 async getActiveSessions ( userId : string ) : Promise < any [ ] > {
252252 const sessionKeys = await this . redisService . keys ( `active_session:${ userId } :*` ) ;
253253 const sessions = [ ] ;
254-
254+
255255 for ( const key of sessionKeys ) {
256256 const sessionData = await this . redisService . get ( key ) ;
257257 if ( sessionData ) {
258258 sessions . push ( JSON . parse ( sessionData ) ) ;
259259 }
260260 }
261-
261+
262262 return sessions ;
263263 }
264264
@@ -272,7 +272,7 @@ export class AuthService {
272272 return sessions . map ( session => ( {
273273 ...session ,
274274 isActive : true ,
275- expiresIn : this . getSessionExpiry ( session . createdAt )
275+ expiresIn : this . getSessionExpiry ( session . createdAt ) ,
276276 } ) ) ;
277277 }
278278
@@ -303,10 +303,10 @@ export class AuthService {
303303
304304 private generateTokens ( user : any ) {
305305 const jti = uuidv4 ( ) ; // JWT ID for blacklisting
306- const payload = {
307- sub : user . id ,
306+ const payload = {
307+ sub : user . id ,
308308 email : user . email ,
309- jti : jti
309+ jti,
310310 } ;
311311
312312 const accessToken = this . jwtService . sign ( payload , {
@@ -320,15 +320,19 @@ export class AuthService {
320320 } ) ;
321321
322322 this . redisService . set ( `refresh_token:${ user . id } ` , refreshToken ) ;
323-
323+
324324 // Store active session
325325 const sessionExpiry = this . configService . get < number > ( 'SESSION_TIMEOUT' , 3600 ) ;
326- this . redisService . setex ( `active_session:${ user . id } :${ jti } ` , sessionExpiry , JSON . stringify ( {
327- userId : user . id ,
328- createdAt : new Date ( ) . toISOString ( ) ,
329- userAgent : 'unknown' , // Would be captured from request in real implementation
330- ip : 'unknown'
331- } ) ) ;
326+ this . redisService . setex (
327+ `active_session:${ user . id } :${ jti } ` ,
328+ sessionExpiry ,
329+ JSON . stringify ( {
330+ userId : user . id ,
331+ createdAt : new Date ( ) . toISOString ( ) ,
332+ userAgent : 'unknown' , // Would be captured from request in real implementation
333+ ip : 'unknown' ,
334+ } ) ,
335+ ) ;
332336
333337 this . logger . debug ( 'Generated new tokens for user' , { userId : user . id , jti } ) ;
334338
0 commit comments