-
Notifications
You must be signed in to change notification settings - Fork 20
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
base: main
Are you sure you want to change the base?
Conversation
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.
저는 함수를 만들어서 json 형태로 반환하는 형태를 작성했었는데, 하린님처럼 ErrorResponse Class를 만들어서 하는 방법 좋은 것 같습니다👍 저도 다음에 적용해봐야겠어요~ 덕분에 알아갑니다😄
catch(exception: HttpException, host: ArgumentsHost) { | ||
const ctx = host.switchToHttp(); | ||
const response = ctx.getResponse(); | ||
const errorResponse = new ErrorResponse(exception); |
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.
위에 ErrorResponse Class를 만들어 놓으니 코드가 한결 깔끔하네요!👍
|
||
export class PhoneVerifyCodeRequestDto { | ||
@IsString() | ||
@Matches(validator.PHONE_NUMBER_REGEX) |
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.
상수화 처리 좋네요👍
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(); |
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.
저는 findOne() 함수를 통해서 가져왔는데, createQueryBuilder를 쓰면 어떤 이점이 있을까요?!
No description provided.