Skip to content

feat: 주문 성공, 취소 시 email 보내는 기능#27

Merged
hyeonjaez merged 3 commits into
mainfrom
feature/order-email
Oct 18, 2025
Merged

feat: 주문 성공, 취소 시 email 보내는 기능#27
hyeonjaez merged 3 commits into
mainfrom
feature/order-email

Conversation

@hyeonjaez

Copy link
Copy Markdown
Collaborator

개요

  • 주문 성공 , 취소 시 email 보내는 기능
  • 여러 bug 들 fix
    • 출석 포인트 미지급 현상
    • jwt filter userId type 불일치로 @AuthenticationPrincipal Integer userId 가 null로 들어오는 현상

PR 유형

어떤 변경 사항이 있나요?

  • 새로운 기능 추가
  • 버그 수정
  • CSS 등 사용자 UI 디자인 변경
  • 코드에 영향을 주지 않는 변경사항(오타 수정, 탭 사이즈 변경, 변수명 변경)
  • 코드 리팩토링
  • 주석 추가 및 수정
  • 문서 추가 및 수정
  • 테스트 추가, 테스트 리팩토링
  • 빌드 부분 혹은 패키지 매니저 수정
  • 파일 혹은 폴더명 수정
  • 파일 혹은 폴더 삭제

@hyeonjaez hyeonjaez requested a review from f-lab-key October 1, 2025 07:09

@f-lab-key f-lab-key left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

수고하셨습니다! 이메일 보내는 부분 잘 작성해주셨네요 ㅎㅎ

별개로 '출석 포인트 미지급 현상'과 같은 부분은 버그를 수정했으면 테스트 코드로도 확실하게 테스트해보면 좋을 것 같아요. Integration test로 사용자가 출석했을 때 사용자에게 포인트가 지급되었는지 최소한의 모킹만 하면서 확인해보는건 어떨까요?

Comment on lines +17 to +23
emailService.sendPurchaseSuccessMail(
event.userEmail(),
event.quantity(),
event.totalPrice(),
event.productName(),
event.codeList()
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이벤트를 그대로 넘기는 것과 파라미터를 펼쳐서 넘기는 것의 장단점이 뭘까요?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

장점은 :

  • email Service는 이벤트 객체에 의존하지 않고 필요한 값만 받기 때문에 결합도가 낮아집니다
  • 메서드 시그니처만 봐도 이 메서드가 어떤 값에 의존하는지 한번에 파악 할수 있습니다

단점

  • 필드가 하나만 추가되어도 메서드 시그니처와 호출하는 곳에서 모두 수정해야 합니다
  • 파라미터가 많아질수록 가독성이 떨어집니다


@Component
@RequiredArgsConstructor
public class PurchaseEmailHandler {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

제 생각에 Handler는 다소 포괄적인 용어라 이 클래스가 어떤 역할을 하는지 확 알기가 어려운 면이 있는 것 같아요. XXXListener, XXXNotifier 등으로 이벤트를 듣고 있다는 것을 알려주면 어떨까요?

@hyeonjaez hyeonjaez merged commit fa71c03 into main Oct 18, 2025
3 checks passed
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