Skip to content

Conversation

@se0hui
Copy link
Contributor

@se0hui se0hui commented Feb 14, 2025

💡 PR 요약

  • POST /auth/email/verify-email 엔드포인트를 통해 이메일 인증 코드 검증 기능을 구현하였습니다.
  • POST /auth/email/signup 엔드포인트를 통해 회원가입 인증 이메일 전송 기능을 구현하였습니다.
  • POST /auth/email/refresh 엔드포인트를 통해 비밀번호 변경 인증 이메일 전송 기능을 구현하였습니다.
    Resolves: [Feat] email 관련 기능 구현 #7

📋 작업 내용

회원가입과 비밀번호 변경을 위한 인증 이메일 전송, 인증 코드 검증, 인증 코드 만료, 삭제 등을 포함하여 구현을 완료하였습니다.

🤝 리뷰 시 참고사항

원래는 이메일 기능을 별도의 email 패키지로 분리할 계획이었으나, email 로직을 auth 패키지 안으로 포함시키기로 변경하였습니다. 이메일 관련 모든 기능은 auth 내에서 관리됩니다.
#8 에서 작업된 test 코드가 적용되지 않아 github action이 실패하였습니다.

✅ 체크리스트

추가적으로 필요한 체크리스트가 있다면 추가적으로 작성해주세요.

  • 이 작업으로 인해 변경이 필요한 문서를 작성 또는 수정했나요? (e.g. README, .env.example)
  • 작업한 코드가 정상적으로 동작하는지 확인했나요?
  • 작업한 코드에 대한 테스트 코드를 작성하거나 수정했나요?
  • Merge 대상 브랜치를 올바르게 설정했나요?
  • 해당 PR과 관련 없는 작업이 포함되지는 않았나요?
  • PR의 올바른 라벨과 리뷰어를 설정했나요?

private final EmailVerificationPort emailVerificationPort;
private final JavaMailSender javaMailSender;

public EmailVerificationService(EmailVerificationPort emailVerificationPort, JavaMailSender javaMailSender) {
Copy link
Member

Choose a reason for hiding this comment

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

현재 생성자 주입을 사용하고 있는데, Lombok의 @RequiredArgsConstructor를 사용하시면 가독성과 유지보수 측면에서 더 좋을 것 같아요.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

9dab2e1

피드백 반영 하였습니다.
리뷰 감사합니다!

import com.ampersand.groom.domain.auth.application.service.EmailVerificationService;
import org.springframework.stereotype.Service;

@Service
Copy link
Member

Choose a reason for hiding this comment

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

현재 @Service를 사용하고 있는데, 만들어둔 @UseCaseWithReadOnlyTransaction이나 @UseCaseTransaction 어노테이션을 적용해보는건 어떤가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

028e202

@UseCaseTransaction 적용하여 피드백 반영하였습니다.
리뷰 감사합니다!

Comment on lines 14 to 23
@RequestMapping("/auth")
public class AuthController {

private final EmailVerificationUseCase emailVerificationUseCase;

public AuthController(EmailVerificationUseCase emailVerificationUseCase) {
this.emailVerificationUseCase = emailVerificationUseCase;
}

@PostMapping("/email/verify-email")

Choose a reason for hiding this comment

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

더 추가 할 기능이 없다면 @RequestMapping("/auth/email")이렇게 쓰셔도 좋을 것 같아요
그리고 API명세서에는 /email/signup 이런 식으로 되어있는데 확인해 보셔야 할 것 같아요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

c520a2c

수정한 API 명세서에 맞게 엔드포인트 수정하였습니다.
리뷰 감사합니다!

Comment on lines 25 to 30
//6자리 숫자 인증 코드 생성
private String generateVerificationCode() {
Random random = new Random();
int code = 10000000 + random.nextInt(90000000);
return String.valueOf(code);
}

Choose a reason for hiding this comment

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

8자리 숫자 인증 코드인데 맞나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

7787679

주석 수정하여 피드백 반영하였습니다.
리뷰 감사합니다!

public ResponseEntity<?> verifyEmail(@RequestBody Map<String, Object> body) {
String code = (String) body.get("code");

if (code == null || code.length() != 8) {
Copy link

Choose a reason for hiding this comment

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

8이라는 숫자를 직접 하드코딩 하는 것보다
상수화시켜 사용해주시는 것이 더욱 명확하게 쓰임새도 알 수 있고 유지보수에도 좋을 것 같습니다

Copy link
Contributor Author

Choose a reason for hiding this comment

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

334075e

인증 코드 길이, 이메일 길이 상수화 시켜 피드백 반영 하였습니다.
리뷰 감사합니다!

Comment on lines 19 to 21
public AuthController(EmailVerificationUseCase emailVerificationUseCase) {
this.emailVerificationUseCase = emailVerificationUseCase;
}
Copy link

Choose a reason for hiding this comment

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

@RequiredArgsConstructor 어노테이션을 알아보고 한번 사용해보시면 좋을 것 같아요
보일러플레이트 코드를 줄일 수 있는 등의 장점이 있습니다

Copy link
Contributor Author

Choose a reason for hiding this comment

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

7b9c962

@RequiredArgsConstructor 적용하여 피드백 반영 하였습니다.
리뷰 감사합니다!

Copy link
Member

@snowykte0426 snowykte0426 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다🙂

@snowykte0426 snowykte0426 added the ✨ Type: Feature 기능 추가 label Feb 19, 2025
Copy link

@yena5511 yena5511 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!!

Copy link
Member

@ta2ye0n ta2ye0n left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!

@se0hui se0hui merged commit ced4ad5 into develop Feb 19, 2025
2 checks passed
@snowykte0426 snowykte0426 deleted the feature/email-api branch March 25, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Type: Feature 기능 추가

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants