Skip to content

Conversation

@DDINGJOO
Copy link
Owner

목적

마케팅 동의 여부와 관계없이 항상 이벤트를 발행하도록 수정합니다.

문제

기존 로직은 ifPresent()를 사용하여 마케팅 동의 요청이 있을 때만 이벤트를 발행했습니다.
회원가입 시 마케팅 동의를 하지 않으면 이벤트가 발행되지 않는 문제가 있었습니다.

해결

orElse(false)를 사용하여 마케팅 동의 요청이 없어도 consented: false로 이벤트를 발행합니다.

변경 전

requests.stream()
    .filter(request -> MARKETING_CONSENT_ID.equals(request.getConsentId()))
    .findFirst()
    .ifPresent(marketingConsent -> {
        // 이벤트 발행
    });

변경 후

boolean consented = requests.stream()
    .filter(request -> MARKETING_CONSENT_ID.equals(request.getConsentId()))
    .findFirst()
    .map(ConsentRequest::isConsented)
    .orElse(false);

// 항상 이벤트 발행
userConsentChangedEventPub.publish(event);

테스트

  • 빌드 성공
  • 전체 테스트 통과

관련 이슈

Related to #72

마케팅 동의가 요청에 없거나 false인 경우에도 이벤트를 발행합니다.

## 변경 사항

- 마케팅 동의가 요청에 있으면 해당 값 사용
- 마케팅 동의가 요청에 없으면 consented=false로 발행
- 테스트 파일에 UserConsentChangedEventPub mock 추가

## 변경 전

ifPresent() 사용 → 마케팅 동의가 요청에 없으면 이벤트 발행 안 함

## 변경 후

orElse(false) 사용 → 마케팅 동의 요청 여부와 관계없이 항상 발행
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants