Skip to content

Commit

Permalink
feat: 전화번호, 코드 기반 인증 코드 조회 로직 구현(#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
Minjae-An committed Mar 27, 2024
1 parent c936d65 commit bf2bc6a
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package yeonba.be.login.repository;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import yeonba.be.exception.GeneralException;
import yeonba.be.exception.LoginException;
import yeonba.be.login.entity.VerificationCode;

@Component
@RequiredArgsConstructor
public class VerificationCodeQuery {

private final VerificationCodeRepository verificationCodeRepository;

public VerificationCode findBy(String phoneNumber, String code) {

return verificationCodeRepository.findByPhoneNumberAndCode(phoneNumber, code)
.orElseThrow(() -> new GeneralException(LoginException.VERIFICATION_CODE_NOT_FOUND));
}
}

0 comments on commit bf2bc6a

Please sign in to comment.