update auth

This commit is contained in:
2025-11-24 16:08:16 +03:30
parent e79040d81e
commit 9996ea3b09
8 changed files with 91 additions and 366 deletions
@@ -19,7 +19,7 @@ export class AdminAuthController {
@ApiResponse({ status: 201, description: 'OTP requested successfully' })
@ApiResponse({ status: 400, description: 'Invalid mobile number' })
otpRequest(@Body() dto: RequestOtpDto) {
return this.authService.requestOtpAdmin(dto);
return this.authService.requestOtp(dto, true);
}
@Post('otp/verify')
@@ -31,28 +31,11 @@ export class AdminAuthController {
return this.authService.verifyOtpAdmin(dto.phone, dto.slug, dto.otp); // assuming dto has `otp` property
}
// @Post('admin/otp/request')
// @ApiOperation({ summary: 'Request OTP for login or signup' })
// @ApiBody({ type: RequestOtpDto, description: 'Mobile number to receive OTP' })
// @ApiResponse({ status: 201, description: 'OTP requested successfully' })
// @ApiResponse({ status: 400, description: 'Invalid mobile number' })
// adminOtpRequest(@Body() dto: RequestOtpDto) {
// return this.authService.requestOtpAdmin(dto);
// }
// @Post('admin/otp/verify')
// @ApiOperation({ summary: 'Verify OTP code' })
// @ApiBody({ type: VerifyOtpDto, description: 'Mobile number and OTP code' })
// @ApiResponse({ status: 200, description: 'OTP verified successfully' })
// @ApiResponse({ status: 400, description: 'Invalid OTP or expired' })
// adminOtpVerify(@Body() dto: VerifyOtpDto) {
// return this.authService.verifyOtpAdmin(dto.phone, dto.otp); // assuming dto has `otp` property
// }
@RefreshTokenRateLimit()
@ApiOperation({ summary: 'refresh the user access token / refresh token' })
@ApiOperation({ summary: 'refresh the admin access token / refresh token' })
@Post('refresh')
refreshToken(@Body() refreshTokenDto: RefreshTokenDto) {
return this.authService.refreshTokenAdmin(refreshTokenDto.refreshToken);
return this.authService.refreshToken(refreshTokenDto.refreshToken, true);
}
}
@@ -19,7 +19,7 @@ export class AuthController {
@ApiResponse({ status: 201, description: 'OTP requested successfully' })
@ApiResponse({ status: 400, description: 'Invalid mobile number' })
otpRequest(@Body() dto: RequestOtpDto) {
return this.authService.requestOtp(dto);
return this.authService.requestOtp(dto, false);
}
@Post('otp/verify')
@@ -31,28 +31,12 @@ export class AuthController {
return this.authService.verifyOtp(dto.phone, dto.slug, dto.otp); // assuming dto has `otp` property
}
// @Post('admin/otp/request')
// @ApiOperation({ summary: 'Request OTP for login or signup' })
// @ApiBody({ type: RequestOtpDto, description: 'Mobile number to receive OTP' })
// @ApiResponse({ status: 201, description: 'OTP requested successfully' })
// @ApiResponse({ status: 400, description: 'Invalid mobile number' })
// adminOtpRequest(@Body() dto: RequestOtpDto) {
// return this.authService.requestOtpAdmin(dto);
// }
// @Post('admin/otp/verify')
// @ApiOperation({ summary: 'Verify OTP code' })
// @ApiBody({ type: VerifyOtpDto, description: 'Mobile number and OTP code' })
// @ApiResponse({ status: 200, description: 'OTP verified successfully' })
// @ApiResponse({ status: 400, description: 'Invalid OTP or expired' })
// adminOtpVerify(@Body() dto: VerifyOtpDto) {
// return this.authService.verifyOtpAdmin(dto.phone, dto.otp); // assuming dto has `otp` property
// }
@RefreshTokenRateLimit()
@ApiOperation({ summary: 'refresh the user access token / refresh token' })
@Post('refresh')
refreshToken(@Body() refreshTokenDto: RefreshTokenDto) {
return this.authService.refreshToken(refreshTokenDto.refreshToken);
return this.authService.refreshToken(refreshTokenDto.refreshToken, false);
}
}