Skip to content

Commit

Permalink
✨ feat: 가입 요청 유저 정보에 대한 유효성 검사 추가 (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinddings committed Nov 6, 2024
1 parent bf295a6 commit 226ce86
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 2 deletions.
78 changes: 78 additions & 0 deletions BE/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions BE/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@nestjs/typeorm": "^10.0.2",
"axios": "^1.7.7",
"bcrypt": "^5.1.1",
"class-transformer": "^0.5.1",
"cross-env": "^7.0.3",
"docker": "^1.0.0",
"dotenv": "^16.4.5",
Expand All @@ -47,6 +48,7 @@
"@types/jest": "^29.5.2",
"@types/node": "^20.3.1",
"@types/supertest": "^6.0.0",
"class-validator": "^0.14.1",
"eslint": "^8.0.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^18.0.0",
Expand Down
4 changes: 2 additions & 2 deletions BE/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Controller, Post, Body } from '@nestjs/common';
import { Controller, Post, Body, ValidationPipe } from '@nestjs/common';
import { AuthService } from './auth.service';
import { AuthCredentialsDto } from './dto/authCredentials.dto';

Expand All @@ -7,7 +7,7 @@ export class AuthController {
constructor(private authService: AuthService) {}

@Post('/signup')
signUp(@Body() authCredentialsDto: AuthCredentialsDto) {
signUp(@Body(ValidationPipe) authCredentialsDto: AuthCredentialsDto) {
return this.authService.signUp(authCredentialsDto);
}
}
9 changes: 9 additions & 0 deletions BE/src/auth/dto/authCredentials.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import { IsString, Matches, MaxLength, MinLength } from 'class-validator';
export class AuthCredentialsDto {
@IsString()
@MinLength(4)
@MaxLength(20)
email: string;

@IsString()
@MinLength(4)
@MaxLength(20)
@Matches(/^[a-zA-Z0-9]*$/)
password: string;
}

0 comments on commit 226ce86

Please sign in to comment.