fix: fix some changes
This commit is contained in:
@@ -9,6 +9,9 @@ import { ApiAppResponse } from '@/common/decorators/api-app-response.decorator';
|
||||
import { NewUserLoginResponseDTO } from './dtos/responses/new-user-login.dto';
|
||||
import { RequirePasswordDTO } from './dtos/responses/require-password.dto';
|
||||
import { TokensResponseDTO } from './dtos/responses/tokens.dto';
|
||||
import { LogoutDTO } from './dtos/logout.dto';
|
||||
import { ActiveUser } from '@/common/decorators/active-user.decorator';
|
||||
import { User } from '@/modules/users/entities/user.entity';
|
||||
|
||||
@Controller('auth')
|
||||
export class AuthController {
|
||||
@@ -126,4 +129,28 @@ export class AuthController {
|
||||
public async refreshToken(@Body() refreshTokenDto: RefreshTokenDTO) {
|
||||
return await this.authService.refreshToken(refreshTokenDto);
|
||||
}
|
||||
|
||||
@Post('logout')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@ApiAppResponse([
|
||||
{
|
||||
status: HttpStatus.OK,
|
||||
variants: [
|
||||
{
|
||||
messageExample: 'با موفقیت خارج شدید.',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
status: HttpStatus.UNAUTHORIZED,
|
||||
variants: [
|
||||
{
|
||||
messageExample: 'دسترسی غیر مجاز',
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
public async logout(@ActiveUser() user: User, @Body() logoutDto: LogoutDTO) {
|
||||
return await this.authService.logout(user.id, logoutDto);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user