Skip to content
This repository was archived by the owner on Dec 6, 2025. It is now read-only.

feat: Poll/Notice 알림 전송 안정화 및 테스트 정비#220

Merged
selentia merged 9 commits into
developfrom
feat/notification-unify-apartment-name
Nov 27, 2025
Merged

feat: Poll/Notice 알림 전송 안정화 및 테스트 정비#220
selentia merged 9 commits into
developfrom
feat/notification-unify-apartment-name

Conversation

@selentia
Copy link
Copy Markdown
Contributor

@selentia selentia commented Nov 27, 2025

주요 변경 사항

1) Poll Activate / Expire 알림이 해당 아파트 주민 전체 + 관리자에게 전송되도록 개선했습니다.

  • activate/expire 핸들러 모두
    • 알림 전송에 try/catch 적용
    • 실패해도 Poll 상태 변경은 영향을 받지 않도록 수정
  • 동시성 제한(Limiter) 적용 유지
  • 전송 실패 시에도 전체 흐름 중단되지 않도록 정비

2) Notice 생성 시 알림 전송 기능을 추가했습니다.

  • 모든 주민 대상 알림 전송 시
    • Promise.allSettled 적용
    • 개별 실패는 무시 (Best-effort 방식)
  • 그 외에 createNotice 로직이 실제 운영 환경에서 보다 안정적으로 동작하도록 개선했습니다.

3) Poll Activate/Expire 통합 테스트 수정

  • 위에서 함수를 수정하는 김에, 이전 테스트의 setTimeout 잔여 타이머가 간섭하던 이슈를 해결했습니다.
    • SSE 호출 검증 방식 개선
      • 전체 호출 수가 아닌
      • pollId 기반 필터링(getSseCallsForPoll) 으로 전환
    • ID 재사용 및 타이머 오염 문제 제거 → 독립 실행 보장

4) 1~2 관련 헬퍼 함수를 추가했습니다.

  • auth 및 apartments repo

- getApartmentNameByIdRepo 추가(apartments.repo)
- auth.service에서 apartmentName 기반 조회로 통일
- 알림 전송용 getUserIdsForApartment(apartmentName) 연동 보강
- activate/expire handler에서 apartmentName 기반으로 통일
- SSE 전송을 createAndSendNotification으로 일원화
- 전송 실패 try/catch 처리(best-effort)
- createNoticeService에서 아파트 주민 전체 알림 전송
- Promise.allSettled 사용해 실패 무시
- apartmentName 기반으로 통일
- getUserIdsForApartment가 apartmentName을 기준으로 동작하도록 관련 레포/서비스 정비
  (apartment.repo, auth.repo, auth.service 에 헬퍼 함수 추가)
- 공지 생성 시 주민 전체 알림 전송 로직 보강
  (전송 실패 시 개별 ignore, Promise.allSettled 적용)
- Poll Activate/Expire 핸들러 알림 전송에 try/catch 적용 및 best-effort 전송으로 변경
- Poll Activate/Expire 통합 테스트에서 pollId 기준 SSE 필터링 로직 추가
  (다른 테스트의 타이머·잔여 call 간섭 제거)
- notifications 테스트의 mock 유저 충돌 해결 및 겹치는 fixture 정리
- 전체 SSE 호출 흐름 정합성 재검증 및 안정화
@selentia selentia added feat New feature label refactor Refactor label labels Nov 27, 2025
@selentia selentia merged commit 78e2639 into develop Nov 27, 2025
1 check passed
@selentia selentia deleted the feat/notification-unify-apartment-name branch November 27, 2025 07:23
@selentia selentia mentioned this pull request Nov 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

feat New feature label refactor Refactor label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant