From 4f8d54ebd61cd1528f9bec89053a24f52c98de45 Mon Sep 17 00:00:00 2001 From: Igor Propisnov Date: Fri, 31 May 2024 08:19:35 +0200 Subject: [PATCH] tidy up --- .../auth-module/controller/auth.controller.ts | 48 +++---------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/backend/src/modules/auth-module/controller/auth.controller.ts b/backend/src/modules/auth-module/controller/auth.controller.ts index 2e25b21..c4c96e6 100644 --- a/backend/src/modules/auth-module/controller/auth.controller.ts +++ b/backend/src/modules/auth-module/controller/auth.controller.ts @@ -41,9 +41,9 @@ export class AuthController { description: 'User signin successfully', type: LoginResponseDto, }) + @HttpCode(HttpStatus.OK) @Public() @Post('signin') - @HttpCode(HttpStatus.OK) public async signin( @Res({ passthrough: true }) response: Response, @Req() request: Request, @@ -52,6 +52,11 @@ export class AuthController { return await this.authService.signin(userCredentials, response, request); } + @ApiCreatedResponse({ + description: 'User tokens refreshed successfully', + type: AccessTokenDto, + }) + @HttpCode(HttpStatus.OK) @Public() @Post('refresh') public async refreshToken(@Req() request: Request): Promise { @@ -62,48 +67,9 @@ export class AuthController { description: 'User signed out successfully', type: Boolean, }) - @Post('logout') @HttpCode(HttpStatus.OK) + @Post('logout') public async logout(@GetCurrentUserId() userId: string): Promise { return this.authService.logout(userId); } - - // @ApiHeader({ - // name: 'Authorization', - // required: true, - // schema: { - // example: 'Bearer ', - // }, - // }) - // @ApiCreatedResponse({ - // description: 'User tokens refreshed successfully', - // type: TokensDto, - // }) - // @Public() - // @UseGuards(RefreshTokenGuard) - // @Post('refresh') - // @HttpCode(HttpStatus.OK) - // public async refresh( - // @GetCurrentUserId() userId: string, - // @GetCurrentUser('refresh_token') refresh_token: string - // ): Promise { - // return this.authService.refresh(userId, refresh_token); - // } - - // @ApiHeader({ - // name: 'Authorization', - // required: true, - // schema: { - // example: 'Bearer ', - // }, - // }) - // @ApiCreatedResponse({ - // description: 'Token validity checked successfully', - // type: Boolean, - // }) - // @Post('check-token') - // @HttpCode(HttpStatus.OK) - // public checkTokenValidity(): Promise { - // return this.authService.checkTokenValidity(); - // } }