@@ -40,16 +40,13 @@ import type {
4040 MessageResult ,
4141 SafeUser ,
4242} from './auth.service' ;
43+ import type { RequestWithUser } from '../types/request.interface' ;
4344import type {
4445 CookieOptions ,
4546 Request as ExpressRequest ,
4647 Response as ExpressResponse ,
4748} from 'express' ;
4849
49- // Express 5 compatible types - using full Express types instead of core types
50- type Request = ExpressRequest ;
51- type Response = ExpressResponse ;
52-
5350// so we can use 'lax' for better security
5451const getCookieOptions = ( ) : CookieOptions => {
5552 const isProduction = process . env . NODE_ENV === 'production' ;
@@ -78,7 +75,7 @@ export class AuthController {
7875 @Post ( 'login' )
7976 async signIn (
8077 @Body ( ) loginDto : LoginDto ,
81- @Res ( { passthrough : true } ) res : Response ,
78+ @Res ( { passthrough : true } ) res : ExpressResponse ,
8279 ) : Promise < { user : SafeUser ; message : string } > {
8380 const result = await this . authService . login ( loginDto ) ;
8481
@@ -123,7 +120,7 @@ export class AuthController {
123120
124121 @Post ( 'logout' )
125122 @HttpCode ( HttpStatus . OK )
126- logout ( @Res ( { passthrough : true } ) res : Response ) : MessageResult {
123+ logout ( @Res ( { passthrough : true } ) res : ExpressResponse ) : MessageResult {
127124 // Clear the cookie
128125 res . clearCookie ( 'access_token' , { path : '/' } ) ;
129126 return { message : 'Logout successful' } ;
@@ -139,8 +136,8 @@ export class AuthController {
139136 @Get ( 'google/callback' )
140137 @UseGuards ( GoogleAuthGuard )
141138 async googleAuthRedirect (
142- @Req ( ) req : Request ,
143- @Res ( ) res : Response ,
139+ @Req ( ) req : RequestWithUser ,
140+ @Res ( ) res : ExpressResponse ,
144141 ) : Promise < void > {
145142 const frontendUrl = this . configService . get < string > ( 'FRONTEND_URL' ) ;
146143
@@ -187,8 +184,8 @@ export class AuthController {
187184 @Get ( 'github/callback' )
188185 @UseGuards ( GithubAuthGuard )
189186 async githubAuthRedirect (
190- @Req ( ) req : Request ,
191- @Res ( ) res : Response ,
187+ @Req ( ) req : RequestWithUser ,
188+ @Res ( ) res : ExpressResponse ,
192189 ) : Promise < void > {
193190 const frontendUrl = this . configService . get < string > ( 'FRONTEND_URL' ) ;
194191
@@ -242,7 +239,7 @@ export class AuthController {
242239 @UseGuards ( JwtAuthGuard )
243240 @HttpCode ( HttpStatus . OK )
244241 async selectRole (
245- @Res ( { passthrough : true } ) res : Response ,
242+ @Res ( { passthrough : true } ) res : ExpressResponse ,
246243 @CurrentUser ( ) user : User ,
247244 @Body ( ) selectRoleDto : SelectRoleDto ,
248245 ) : Promise < { user : SafeUser ; accessToken : string ; message : string } > {
@@ -353,7 +350,7 @@ export class AuthController {
353350 async deleteAccount (
354351 @CurrentUser ( ) user : User ,
355352 @Body ( ) deleteAccountDto : DeleteAccountDto ,
356- @Res ( { passthrough : true } ) res : Response ,
353+ @Res ( { passthrough : true } ) res : ExpressResponse ,
357354 ) : Promise < MessageResult > {
358355 const result = await this . authService . deleteAccount (
359356 user . id ,
0 commit comments