인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

roider23164240's profile image
roider23164240

asked

Slack Clone Coding [Backend with NestJS + TypeORM]

Unit Testing

유저 컨트롤러 코드 질문

Written on

·

178

·

Edited

0

깃허브 코드를 보면

  @ApiOperation({ summary: '회원가입' })
  @UseGuards(NotLoggedInGuard)
  @Post()
  async join(@Body() data: JoinRequestDto) {
    const user = this.usersService.findByEmail(data.email);
    if (!user) {
      throw new NotFoundException();
    }
    const result = await this.usersService.join(
      data.email,
      data.nickname,
      data.password,
    );
    if (result) {
      return 'ok';
    } else {
      throw new ForbiddenException();
    }
  }

이런데 여기서 user가 없는데 왜 NotFoundException()을 날리는 건가요? user가 없으면 그대로 join하여 사용자 등록을 해야 하는 것이 아닌가요?

node.jsexpressnestjstypeorm

Answer 1

1

zerocho님의 프로필 이미지
zerocho
Instructor

앗, 그러네요. 수정했습니다!

roider23164240's profile image
roider23164240

asked

Ask a question