This commit is contained in:
2026-03-10 10:47:25 +03:30
parent d07f7d3777
commit 4104bab0c6
64 changed files with 189 additions and 38637 deletions
+40 -40
View File
@@ -14,52 +14,52 @@ import { SuperAdminAuthGuard } from '../guards/superAdminAuth.guard';
export class AuthController {
constructor(private readonly authService: AuthService) { }
@Throttle({ default: { limit: 3, ttl: 180_000 } })
@Post('public/auth/otp/request')
@ApiOperation({ summary: 'Request OTP for login or signup' })
@ApiBody({ type: RequestOtpDto, description: 'Mobile number to receive OTP' })
otpRequest(@Body() dto: RequestOtpDto) {
return this.authService.requestOtp(dto, false);
}
// @Throttle({ default: { limit: 3, ttl: 180_000 } })
// @Post('public/auth/otp/request')
// @ApiOperation({ summary: 'Request OTP for login or signup' })
// @ApiBody({ type: RequestOtpDto, description: 'Mobile number to receive OTP' })
// otpRequest(@Body() dto: RequestOtpDto) {
// return this.authService.requestOtp(dto, false);
// }
@RefreshTokenRateLimit()
@ApiOperation({ summary: 'refresh the user access token / refresh token' })
@Post('public/auth/refresh')
refreshToken(@Body() refreshTokenDto: RefreshTokenDto) {
return this.authService.refreshToken(refreshTokenDto.refreshToken);
}
// @RefreshTokenRateLimit()
// @ApiOperation({ summary: 'refresh the user access token / refresh token' })
// @Post('public/auth/refresh')
// refreshToken(@Body() refreshTokenDto: RefreshTokenDto) {
// return this.authService.refreshToken(refreshTokenDto.refreshToken);
// }
@Throttle({ default: { limit: 3, ttl: 180_000 } })
@Post('admin/auth/otp/request')
@ApiOperation({ summary: 'Request OTP for login or signup' })
@ApiBody({ type: RequestOtpDto, description: 'Mobile number to receive OTP' })
otpRequestAdmin(@Body() dto: RequestOtpDto) {
return this.authService.requestOtp(dto, true);
}
// @Throttle({ default: { limit: 3, ttl: 180_000 } })
// @Post('admin/auth/otp/request')
// @ApiOperation({ summary: 'Request OTP for login or signup' })
// @ApiBody({ type: RequestOtpDto, description: 'Mobile number to receive OTP' })
// otpRequestAdmin(@Body() dto: RequestOtpDto) {
// return this.authService.requestOtp(dto, true);
// }
@Post('admin/auth/otp/verify')
@ApiOperation({ summary: 'Verify OTP code' })
@ApiBody({ type: VerifyOtpDto, description: 'Mobile number and OTP code' })
otpVerifyAdmin(@Body() dto: VerifyOtpDto) {
return this.authService.verifyOtpAdmin(dto.phone, dto.slug, dto.otp);
}
// @Post('admin/auth/otp/verify')
// @ApiOperation({ summary: 'Verify OTP code' })
// @ApiBody({ type: VerifyOtpDto, description: 'Mobile number and OTP code' })
// otpVerifyAdmin(@Body() dto: VerifyOtpDto) {
// return this.authService.verifyOtpAdmin(dto.phone, dto.slug, dto.otp);
// }
@RefreshTokenRateLimit()
@ApiOperation({ summary: 'refresh the admin access token / refresh token' })
@Post('admin/auth/refresh')
refreshTokenAdmin(@Body() refreshTokenDto: RefreshTokenDto) {
return this.authService.refreshToken(refreshTokenDto.refreshToken);
}
// @RefreshTokenRateLimit()
// @ApiOperation({ summary: 'refresh the admin access token / refresh token' })
// @Post('admin/auth/refresh')
// refreshTokenAdmin(@Body() refreshTokenDto: RefreshTokenDto) {
// return this.authService.refreshToken(refreshTokenDto.refreshToken);
// }
//super admin routes
// //super admin routes
@UseGuards(SuperAdminAuthGuard)
@Post('super-admin/auth/direct-login')
@ApiOperation({ summary: 'Direct login for DSC - returns login credentials' })
@ApiBody({ type: DirectLoginDto, description: 'Phone number and restaurant slug for direct login' })
directloginForDsc(@Body() dto: DirectLoginDto) {
return this.authService.loginAdminForDsc(dto.phone, dto.slug);
}
// @UseGuards(SuperAdminAuthGuard)
// @Post('super-admin/auth/direct-login')
// @ApiOperation({ summary: 'Direct login for DSC - returns login credentials' })
// @ApiBody({ type: DirectLoginDto, description: 'Phone number and restaurant slug for direct login' })
// directloginForDsc(@Body() dto: DirectLoginDto) {
// return this.authService.loginAdminForDsc(dto.phone, dto.slug);
// }
}