import { Body, Controller, HttpCode, HttpStatus, Post } from '@nestjs/common'; import { LoginDTO } from './dtos/login.dto'; import { AuthService } from './providers/auth.service'; import { VerifyOtpDTO } from './dtos/verify-otp.dto'; import { Public } from './decorators/public.decorator'; import { RefreshTokenDTO } from './dtos/refresh-token.dto'; @Controller('auth') export class AuthController { constructor( /** * Inject Auth Service */ private readonly authService: AuthService, ) {} @Public() @Post('login') @HttpCode(HttpStatus.OK) public async logIn(@Body() loginDto: LoginDTO) { return await this.authService.logIn(loginDto); } @Public() @Post('verify-otp') @HttpCode(HttpStatus.OK) public async verifyOTP(@Body() verifyOtpDto: VerifyOtpDTO) { return await this.authService.verifyOTP(verifyOtpDto); } @Public() @Post('refresh') @HttpCode(HttpStatus.OK) public async refreshToken(@Body() refreshTokenDto: RefreshTokenDTO) { return await this.authService.refreshToken(refreshTokenDto); } }