-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 회원 가입 및 로그인 API 구현 #4
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
Conversation
| inject: [ConfigService], | ||
| useFactory: async (config: ConfigService) => ({ | ||
| secret: config.get<string>('JWT_SECRET'), | ||
| signOptions: { expiresIn: '1d' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[tip / not issue] 1d 같은 부분은 설정으로 따로 빼면 좋습니다
|
|
||
| @Get(':id') | ||
| findOne(@Param('id', ParseIntPipe) id: number) { | ||
| return this.usersService.findOne(+id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
암시적 변환이 아닌 명시적 변환 코드가 좋습니다
| expect(result.password).toBe(hashedPassword); | ||
| }); | ||
|
|
||
| it('email 중복 체크', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테스트 코드 naming 을 할때에는 기대 결과와 조건 실제 상태등이 드러나는 이름으로 지으면 좋습니다.
키워드로 "테스트 코드 네이밍" 등을 검색해서 학습하신 후 본인이 선호되는 스타일로 이름을 다시 지어주세요~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분 리뷰가 반영이 되지 않았습니다
|
|
||
| jest.mock('bcrypt'); | ||
|
|
||
| describe('UsersService', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테스트 코드 있어서 너무 좋습니다! 👍
| async create(createUserDto: CreateUserDto): Promise<User> { | ||
| const existingUser = await this.findByEmail(createUserDto.email); | ||
| if (existingUser) { | ||
| throw new ConflictException('이미 존재하는 이메일입니다.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
다양한 status code 를 잘 활용하시는 부분이 좋습니다! 👍
|
https://docs.nestjs.com/pipes#providing-defaults 이 코드 예시를 보면 ParseIntPipe 를 적용하면 알아서 Number 로 되기 때문에 Number 생성자를 중복으로 쓰지 않아도 되지 않나요? |
|


개요
로그인 및 회원가입 기능을 추가하고, 회원가입에 대한 기본 테스트 코드를 작성한 풀 리퀘스트입니다.
주요 변경 사항
기술적 구현 내용
추후 계획