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