Files
pdi_api/src/auth/auth.controller.ts
T
2024-09-17 17:29:43 -06:00

30 lines
654 B
TypeScript

import {
BadRequestException,
Body,
Controller,
Header,
HttpCode,
HttpStatus,
Logger,
Post,
} from '@nestjs/common';
import { AuthService } from './auth.service';
import { LoginDTO } from '../dtos/loginDTO';
@Controller('auth')
export class AuthController {
constructor(private readonly authService: AuthService) {}
@HttpCode(HttpStatus.OK)
@Post('login')
@Header('content-type', 'application/json')
login(@Body() loginDto: LoginDTO): Promise<any> {
Logger.log('/auth/loin/', 'requested');
if (loginDto) {
return this.authService.signIn(loginDto);
} else {
throw new BadRequestException();
}
}
}