Skip to content

refactor: 알림 발행 이벤트 기반으로 전환 및 관리자 알림 쿼리 오류 수정#116

Merged
tnals0924 merged 3 commits into
developfrom
refactor/#115
Jun 1, 2026
Merged

refactor: 알림 발행 이벤트 기반으로 전환 및 관리자 알림 쿼리 오류 수정#116
tnals0924 merged 3 commits into
developfrom
refactor/#115

Conversation

@tnals0924

Copy link
Copy Markdown
Member

#️⃣연관된 이슈

📝작업 내용

버그 수정

USER_RETURN_APPROVED 알림 누락

  • NotificationRepositoryCustomImplUSER_TYPE 리스트에 USER_RETURN_APPROVED가 없어 반납 승인 알림이 저장은 되지만 사용자에게 조회되지 않던 문제 수정

FCMService 예외 처리 정상화

  • sendAsync()는 non-blocking으로 try-catch가 동작하지 않아 FCM 오류가 완전히 무시되던 문제 수정
  • 동기 send()로 교체하여 FirebaseMessagingException 정상 처리 (비동기 처리는 이벤트 핸들러의 @Async에 위임)

관리자 알림 조회 쿼리 수정

  • 관리자 알림은 member = null로 저장되는 공지식 구조인데, 기존 쿼리가 member.id = memberId 조건을 사용해 항상 빈 결과를 반환하던 문제 수정
  • member IS NULL 조건으로 변경

리팩토링

ApplicationEventPublisher 기반 알림 발행으로 전환

RentalServiceNotificationService를 직접 호출하던 구조를, 도메인 이벤트 발행 방식으로 전환했습니다.

[기존]
RentalService → NotificationService.sendNotification() (트랜잭션 내 FCM 호출)

[변경]
RentalService → eventPublisher.publishEvent()
                    ↓ @TransactionalEventListener(AFTER_COMMIT) + @Async
NotificationEventHandler → NotificationService
  • 트랜잭션 커밋 이후에만 알림 발송 → 롤백 시 불필요한 FCM 푸시 방지
  • RentalService에서 NotificationService 의존 제거
  • 이벤트 클래스: RentalAppliedEvent, RentalCancelledEvent, ReturnAppliedEvent, RentalStatusChangedEvent

💬리뷰 요구사항(선택)

@tnals0924 tnals0924 self-assigned this Jun 1, 2026
@tnals0924 tnals0924 added the refactoring 코드 리팩터링 label Jun 1, 2026
@tnals0924 tnals0924 merged commit bec9153 into develop Jun 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring 코드 리팩터링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: ApplicationEventPublisher 기반 알림 발행으로 전환 및 관리자 알림 버그 수정

1 participant