44import hs .kr .backend .devpals .domain .auth .dto .EmailVertificationRequest ;
55import hs .kr .backend .devpals .domain .auth .dto .ResetPasswordRequest ;
66import hs .kr .backend .devpals .domain .auth .entity .EmailVertificationEntity ;
7- import hs .kr .backend .devpals .domain .auth .repository .AuthenticodeRepository ;
7+ import hs .kr .backend .devpals .domain .auth .repository .AuthRepository ;
88import hs .kr .backend .devpals .domain .project .entity .ApplicantEntity ;
99import hs .kr .backend .devpals .domain .project .entity .ProjectEntity ;
1010import hs .kr .backend .devpals .domain .user .entity .UserEntity ;
3636public class AuthEmailService {
3737
3838 private final JavaMailSender javaMailSender ;
39- private final AuthenticodeRepository authenticodeRepository ;
39+ private final AuthRepository authRepository ;
4040 private final UserRepository userRepository ;
4141 private final PasswordEncoder passwordEncoder ;
4242 @ Qualifier ("emailExecutor" )
@@ -48,15 +48,15 @@ public ResponseEntity<ApiResponse<String>> emailSend(EmailRequest request) {
4848 String email = request .getEmail ();
4949
5050 // 기존 인증 코드 삭제 (중복 방지)
51- authenticodeRepository .deleteByUserEmail (email );
51+ authRepository .deleteByUserEmail (email );
5252
5353 // 새로운 인증 코드 생성
5454 String verificationCode = generateVerificationCode ();
5555 LocalDateTime expiresAt = LocalDateTime .now ().plusMinutes (5 ); // 5분 후 만료
5656
5757 // DB에 저장
5858 EmailVertificationEntity authCode = new EmailVertificationEntity (email , verificationCode , expiresAt );
59- authenticodeRepository .save (authCode );
59+ authRepository .save (authCode );
6060
6161 // 이메일 전송
6262 try {
@@ -73,7 +73,7 @@ public ResponseEntity<ApiResponse<String>> sendEmailVerification(EmailVertificat
7373 String email = request .getEmail ();
7474 String code = request .getCode ();
7575
76- EmailVertificationEntity authCode = authenticodeRepository .findTopByUserEmailOrderByExpiresAtDesc (email )
76+ EmailVertificationEntity authCode = authRepository .findTopByUserEmailOrderByExpiresAtDesc (email )
7777 .orElseThrow (() -> new CustomException (ErrorException .EMAIL_SEND_FAILED ));
7878
7979 // 만료 시간 확인
@@ -88,7 +88,7 @@ public ResponseEntity<ApiResponse<String>> sendEmailVerification(EmailVertificat
8888
8989 // 인증 완료 처리
9090 authCode .useCode ();
91- authenticodeRepository .save (authCode );
91+ authRepository .save (authCode );
9292
9393 return ResponseEntity .ok (new ApiResponse <>(200 , true , "이메일 인증 성공" , null ));
9494 }
@@ -141,7 +141,7 @@ public ResponseEntity<ApiResponse<String>> resetPassword(ResetPasswordRequest re
141141 String newPassword = request .getNewPassword ();
142142
143143 // 인증 코드 확인
144- EmailVertificationEntity authCode = authenticodeRepository .findTopByUserEmailOrderByExpiresAtDesc (email )
144+ EmailVertificationEntity authCode = authRepository .findTopByUserEmailOrderByExpiresAtDesc (email )
145145 .orElseThrow (() -> new CustomException (ErrorException .INVALID_CODE ));
146146
147147 // 입력된 코드가 저장된 코드와 일치하는지 확인
@@ -164,7 +164,7 @@ public ResponseEntity<ApiResponse<String>> resetPassword(ResetPasswordRequest re
164164
165165 // 인증 코드 사용 처리
166166 authCode .useCode ();
167- authenticodeRepository .save (authCode );
167+ authRepository .save (authCode );
168168
169169 return ResponseEntity .ok (new ApiResponse <>(200 , true , "비밀번호가 성공적으로 변경되었습니다." , null ));
170170 }
0 commit comments