refactor: 알림 발송 로직 통합 및 알림 발송 DSL 도입#131
Merged
Merged
Conversation
토큰뿐 아니라 사용자 디바이스 정보를 등록한다는 개념으로 확장
기존 서비스 클래스 제거 후 일관된 DSL 체인 방식으로 알림 처리 흐름 단순화
보내야 할 토큰이 여러 개일 경우, 한 번의 요청으로 전송 가능해 성능 향상
Contributor
Author
|
RenderedNotification 수정 예정입니다 (푸시 알림 title, 푸시 알림 body, 인앱 알림 body 분리) |
notification 테이블은 "인앱알림"이므로 title 제거
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 요약(Summary)
이번 PR은 알림 발송 로직을 DSL(Domain-Specific Language) 기반으로 리팩터링해서
다른 도메인에서 알림을 훨씬 쉽고 유연하게 보낼 수 있게 만든 게 핵심이에요.
1. 알림의 종류: 행동 알림 vs 시스템 알림
알림은 크게 두 가지로 나눌 수 있다고 생각해요.
→ 특정 사용자의 행동(좋아요, 댓글, 제안 등)에 의해 다른 사용자에게 전달되는 알림
→ 예: “철수님이 내 컬렉션에 댓글을 남겼어요.”
→ 서비스 운영이나 시스템 상태 변화에 따라 전송되는 알림
→ 예: “새로운 기능이 추가되었어요”, “점검 안내”
이번에 만든 NotifyActionDsl은 이 중에서 행동 알림에 특화된 DSL이에요.
→ 행동 주체(
Actor), 대상(Target), 행동 종류(ActionKind)를 자연스럽게 지정할 수 있게 설계했어요.2. DSL(Domain-Specific Language) 소개
DSL은 특정 도메인(여기서는 “알림 발송”)에 특화된 작은 언어예요.
범용 프로그래밍 언어보다 그 도메인의 작업을 간결하고 직관적으로 표현할 수 있게 설계돼요.
이번 PR에서 DSL은 행동 알림을
by(누가) →on(무엇에 대해) →did(무슨 행동을) → 옵션 설정 →to(누구에게)순서로 자연스럽게 작성할 수 있게 해줘요.
예:
이렇게 쓰면 읽기 쉽고, IDE 자동완성 도움으로 실수를 줄일 수 있어요.
그리고 알림 종류별로 메서드를 따로 외울 필요도 없어요.
3. 주요 변화
PushNotificationService 제거
sendCollectionLikeNotification,sendCollectionCommentNotification처럼 메서드가 여러 개 있었어요.다른 도메인 서비스에서 DSL 사용
PushNotificationService의존성을 없애고NotifyActionDsl을 사용하게 바뀌었어요.4. NotificationPublisher: 단 하나의 메서드로 공통 파이프라인 처리
이제 모든 알림은
NotificationPublisher의 단 하나의 메서드에서 처리돼요.알림 저장과 푸시 발송을 같은 흐름에서 공통으로 수행하죠.
📌 포인트
push()한 곳에서① 메시지 렌더링 → ② 딥링크 생성 → ③ 인앱 저장 → ④ 배지 카운트 → ⑤ 푸시 전송
이 순서로 처리돼요.
5. 기대 효과
✅ PR Checklist
PR이 다음 요구 사항을 충족하는지 확인하세요.