Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] 회원가입 API 구현 #29

Merged
merged 10 commits into from
Nov 7, 2024
Merged
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",
jinddings marked this conversation as resolved.
Show resolved Hide resolved
"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';
Copy link
Collaborator

@uuuo3o uuuo3o Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 이런 네이밍 규칙도 나중에 이야기해보면 좋겠네요!
저는 케밥 케이스 방식을 써서
auth-credential.dto 이런 식으로 작성하고 있었거든요!

Copy link
Collaborator Author

@jinddings jinddings Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런 네이밍 규칙도 나중에 이야기해보면 좋겠네요! 저는 케밥 케이스 방식을 써서 auth-credential.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;
}