This commit is contained in:
Igor Hrenowitsch Propisnov 2024-05-31 08:19:35 +02:00
parent b5c850d178
commit 4f8d54ebd6
1 changed files with 7 additions and 41 deletions

View File

@ -41,9 +41,9 @@ export class AuthController {
description: 'User signin successfully', description: 'User signin successfully',
type: LoginResponseDto, type: LoginResponseDto,
}) })
@HttpCode(HttpStatus.OK)
@Public() @Public()
@Post('signin') @Post('signin')
@HttpCode(HttpStatus.OK)
public async signin( public async signin(
@Res({ passthrough: true }) response: Response, @Res({ passthrough: true }) response: Response,
@Req() request: Request, @Req() request: Request,
@ -52,6 +52,11 @@ export class AuthController {
return await this.authService.signin(userCredentials, response, request); return await this.authService.signin(userCredentials, response, request);
} }
@ApiCreatedResponse({
description: 'User tokens refreshed successfully',
type: AccessTokenDto,
})
@HttpCode(HttpStatus.OK)
@Public() @Public()
@Post('refresh') @Post('refresh')
public async refreshToken(@Req() request: Request): Promise<AccessTokenDto> { public async refreshToken(@Req() request: Request): Promise<AccessTokenDto> {
@ -62,48 +67,9 @@ export class AuthController {
description: 'User signed out successfully', description: 'User signed out successfully',
type: Boolean, type: Boolean,
}) })
@Post('logout')
@HttpCode(HttpStatus.OK) @HttpCode(HttpStatus.OK)
@Post('logout')
public async logout(@GetCurrentUserId() userId: string): Promise<boolean> { public async logout(@GetCurrentUserId() userId: string): Promise<boolean> {
return this.authService.logout(userId); return this.authService.logout(userId);
} }
// @ApiHeader({
// name: 'Authorization',
// required: true,
// schema: {
// example: 'Bearer <refresh_token>',
// },
// })
// @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<TokensDto> {
// return this.authService.refresh(userId, refresh_token);
// }
// @ApiHeader({
// name: 'Authorization',
// required: true,
// schema: {
// example: 'Bearer <access_token>',
// },
// })
// @ApiCreatedResponse({
// description: 'Token validity checked successfully',
// type: Boolean,
// })
// @Post('check-token')
// @HttpCode(HttpStatus.OK)
// public checkTokenValidity(): Promise<boolean> {
// return this.authService.checkTokenValidity();
// }
} }