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

[김하린] 휴대폰 인증 API #6

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

kimhalin
Copy link

No description provided.

Copy link
Member

Choose a reason for hiding this comment

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

저는 함수를 만들어서 json 형태로 반환하는 형태를 작성했었는데, 하린님처럼 ErrorResponse Class를 만들어서 하는 방법 좋은 것 같습니다👍 저도 다음에 적용해봐야겠어요~ 덕분에 알아갑니다😄

catch(exception: HttpException, host: ArgumentsHost) {
const ctx = host.switchToHttp();
const response = ctx.getResponse();
const errorResponse = new ErrorResponse(exception);
Copy link
Member

Choose a reason for hiding this comment

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

위에 ErrorResponse Class를 만들어 놓으니 코드가 한결 깔끔하네요!👍


export class PhoneVerifyCodeRequestDto {
@IsString()
@Matches(validator.PHONE_NUMBER_REGEX)
Copy link
Member

Choose a reason for hiding this comment

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

상수화 처리 좋네요👍

Comment on lines +42 to +49
const phoneVerification = await this.phoneVerifyRepository
.createQueryBuilder('pv')
.where('pv.phoneNumber = :phoneNumber', { phoneNumber: dto.phoneNumber })
.andWhere('pv.verifyCode = :verifyCode', { verifyCode: dto.verifyCode })
.andWhere('pv.isVerified = false')
.andWhere('pv.expiredAt > NOW()')
.orderBy({ createdAt: 'DESC' })
.getOne();
Copy link
Member

Choose a reason for hiding this comment

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

저는 findOne() 함수를 통해서 가져왔는데, createQueryBuilder를 쓰면 어떤 이점이 있을까요?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants