Skip to content

Commit be919d4

Browse files
Merge pull request #484 from wumibals/authGuards
implemented the dtos
2 parents 721d730 + b6f29ea commit be919d4

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

backend/src/auth/dto/login.dto.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { ApiProperty } from '@nestjs/swagger';
2+
import { IsEmail, IsString } from 'class-validator';
3+
4+
export class LoginDto {
5+
@ApiProperty({ example: 'john@example.com' })
6+
@IsEmail()
7+
email: string;
8+
9+
@ApiProperty({ example: 'StrongPass123!' })
10+
@IsString()
11+
password: string;
12+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { ApiProperty } from '@nestjs/swagger';
2+
import { IsEmail, IsString, MinLength, MaxLength } from 'class-validator';
3+
4+
export class RegisterDto {
5+
@ApiProperty({ example: 'John' })
6+
@IsString()
7+
@MaxLength(50)
8+
firstName: string;
9+
10+
@ApiProperty({ example: 'Doe' })
11+
@IsString()
12+
@MaxLength(50)
13+
lastName: string;
14+
15+
@ApiProperty({ example: 'john@example.com' })
16+
@IsEmail()
17+
email: string;
18+
19+
@ApiProperty({ example: 'StrongPass123!' })
20+
@IsString()
21+
@MinLength(8)
22+
@MaxLength(100)
23+
password: string;
24+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { Injectable } from '@nestjs/common';
2+
import { AuthGuard } from '@nestjs/passport';
3+
4+
@Injectable()
5+
export class JwtAuthGuard extends AuthGuard('jwt') {}

0 commit comments

Comments
 (0)