create simpel login
This commit is contained in:
@@ -1,4 +1,27 @@
|
||||
import { Controller } from '@nestjs/common';
|
||||
import {
|
||||
BadRequestException,
|
||||
Body,
|
||||
Controller,
|
||||
HttpCode,
|
||||
HttpStatus,
|
||||
Logger,
|
||||
Post,
|
||||
} from '@nestjs/common';
|
||||
import { AuthService } from './auth.service';
|
||||
import { LoginDTO } from '../dtos/loginDTO';
|
||||
|
||||
@Controller('auth')
|
||||
export class AuthController {}
|
||||
export class AuthController {
|
||||
constructor(private readonly authService: AuthService) {}
|
||||
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('login')
|
||||
login(@Body() loginDto: LoginDTO): Promise<any> {
|
||||
Logger.log('/auth/loin/', 'requested');
|
||||
if (loginDto) {
|
||||
return this.authService.signIn(loginDto);
|
||||
} else {
|
||||
throw new BadRequestException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user