Added Simple Auth with JWT Tokens and Postgres #2
|
@ -17,16 +17,20 @@ export class AuthController {
|
|||
constructor(private readonly authService: AuthService) {}
|
||||
|
||||
@Public()
|
||||
@Post('local/signup')
|
||||
@Post('signup')
|
||||
@HttpCode(HttpStatus.CREATED)
|
||||
public async signup(@Body() userCredentials: UserCredentialsDto): Promise<Tokens> {
|
||||
public async signup(
|
||||
@Body() userCredentials: UserCredentialsDto
|
||||
): Promise<Tokens> {
|
||||
return this.authService.signup(userCredentials);
|
||||
}
|
||||
|
||||
@Public()
|
||||
@Post('local/signin')
|
||||
@Post('signin')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
public async signin(@Body() userCredentials: UserCredentialsDto): Promise<Tokens> {
|
||||
public async signin(
|
||||
@Body() userCredentials: UserCredentialsDto
|
||||
): Promise<Tokens> {
|
||||
return this.authService.signin(userCredentials);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { IsEmail, IsNotEmpty, IsString } from 'class-validator';
|
||||
import { IsEmail, IsNotEmpty, IsString, MinLength } from 'class-validator';
|
||||
|
||||
export class UserCredentialsDto {
|
||||
@IsNotEmpty()
|
||||
|
@ -7,5 +7,6 @@ export class UserCredentialsDto {
|
|||
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@MinLength(8)
|
||||
public password: string;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue