You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #140의 Outbox 기반 푸시 발송 인프라에 Post-log 알림 2종을 연결합니다. 각 알림은 사진 등록·티켓(한줄 후기) 생성 트랜잭션 안에서 NotificationService로 앱 내 알림과 Outbox를 함께 저장하고, 실제 푸시는 기존 Outbox Worker가 비동기로 발송합니다.
알림 명령 조립: PostLogNotificationCommands에서 문구와 중복 방지 키를 만듭니다. PreLogNotificationCommands와 같은 형태입니다.
POST_LOG_PHOTOS_REGISTERED:{이번 요청에서 새로 저장된 사진 중 최소 사진 ID}:{수신자 ID}
POST_LOG_REVIEW_CREATED:{티켓 ID}:{수신자 ID}
사진 등록 알림: PostLogPhotoRegistrationService.register()에서 사진을 저장한 직후 notifyPhotosRegistered()로 알림을 저장합니다.
여러 장을 한 번에 등록해도 수신자당 알림은 1건입니다.
이미 등록된 사진만 다시 보내는 재시도 요청처럼 새로 저장된 사진이 없으면 알림을 저장하지 않습니다.
후기 등록 알림: PostLogService.createTicket()에서 티켓을 저장하고 임시저장을 정리한 뒤 notifyReviewCreated()로 알림을 저장합니다.
임시저장(saveDraft())에는 알림을 저장하지 않습니다.
수신 대상은 두 알림 모두 기존 MeetingParticipantRepository.findAllActiveWithUserByMeetingId()를 재사용해 조회하고, 행동한 본인은 제외합니다.
테스트
./gradlew ktlintCheck
./gradlew test
결과: 전부 성공 (588개 테스트 통과, 실패·건너뜀 0)
추가·수정한 테스트
PostLogPhotoRegistrationNotificationIntegrationTest(MySQL, 신규): 사진 2장을 한 번에 등록하면 업로더를 제외한 참여자에게 알림과 Outbox가 1건씩 저장되는지(문구, 중복 방지 키, targetId 확인), 이미 등록된 사진만 다시 등록하면 알림이 저장되지 않는지
PostLogServiceIntegrationTest(MySQL): 티켓 생성 시 작성자를 제외한 참여자에게 알림과 Outbox가 저장되는지, 임시저장이나 티켓 중복 생성에는 알림이 저장되지 않는지
PostLogPhotoRegistrationServiceTest(H2): 서비스에 추가된 의존성 연결만 반영했습니다.
API 변경
없음 (사진 등록·티켓 생성 API의 요청·응답 형식은 변경 없음, 알림 저장만 추가)
DB 및 설정 변경
없음
NotificationType의 POST_LOG_PHOTOS_REGISTERED, POST_LOG_REVIEW_CREATED(→ POST_LOG)는 이미 정의되어 있어 변경하지 않았습니다.
리뷰 시 참고 사항
사진 알림 단위: 알림은 등록 요청 단위로 저장합니다. 클라이언트가 사진마다 등록 API를 따로 호출하면 장수만큼 알림이 가므로, 여러 장을 한 번의 요청으로 보내야 합니다. 일정 시간 안의 여러 요청을 묶는 처리는 이번 PR에 포함하지 않았습니다.
동시 요청: 사진 등록은 만남 행 비관적 락(findByIdWithGroupForUpdate)으로, 티켓 생성은 유니크 제약으로 중복을 막기 때문에 같은 요청이 동시에 들어와도 알림이 중복 저장되지 않습니다.
알림 테스트 DB: 알림 저장 SQL의 ON DUPLICATE KEY UPDATE를 H2가 지원하지 않아 알림 검증은 MySQL Testcontainers 테스트에서 수행했습니다.
의존 방향: postlog → notification 단방향 의존만 추가했습니다.
범위 밖: 사진이 삭제된 뒤 이미 받은 알림을 눌렀을 때의 처리는 이번 PR에 포함하지 않았습니다.
체크리스트
변경 범위에 맞는 테스트를 실행했습니다.
계층 책임을 지키고 필요한 문서를 갱신했습니다.
비밀번호, 토큰, 개인정보 등 민감정보를 포함하지 않았습니다.
관련 없는 변경을 포함하지 않았습니다.
Summary by CodeRabbit
새 기능
사진을 등록하면 등록자를 제외한 모임 참여자에게 알림이 전송됩니다. 새 사진이 없는 경우에는 알림이 전송되지 않습니다.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
📝 Walkthrough
Walkthrough
사진 등록과 티켓 생성 흐름에 Post-log 알림 저장을 추가합니다. 알림은 행동한 사용자를 제외한 활성 만남 참여자에게 전달됩니다. 사진 재등록과 후기 초안 저장 등 알림이 생성되지 않는 조건도 테스트합니다.
Changes
Post-log 알림
Layer / File(s)
Summary
알림 명령 구성 src/main/kotlin/org/com/belog/postlog/service/PostLogNotificationCommands.kt
사진 등록 및 후기 생성 알림의 유형, 메시지, 만남 ID와 중복 방지 키를 구성하는 명령 함수를 추가합니다.
사진 등록 알림 src/main/kotlin/org/com/belog/postlog/service/PostLogPhotoRegistrationService.kt, src/test/kotlin/org/com/belog/postlog/service/PostLogPhotoRegistrationServiceTest.kt, src/test/kotlin/org/com/belog/postlog/service/PostLogPhotoRegistrationNotificationIntegrationTest.kt
새 사진 저장 후 업로더를 제외한 활성 참여자마다 알림을 생성합니다. 테스트는 수신자별 알림 및 Outbox 저장과 기존 사진만 재등록할 때 알림을 추가하지 않는 동작을 확인합니다.
후기 생성 알림 src/main/kotlin/org/com/belog/postlog/service/PostLogService.kt, src/test/kotlin/org/belog/postlog/service/PostLogServiceIntegrationTest.kt
티켓 저장 후 작성자를 제외한 활성 참여자에게 알림을 생성합니다. 테스트는 알림 필드와 Outbox 저장을 확인하며, 초안 저장과 중복 티켓 생성에서 알림이 추가되지 않는지 검증합니다.
sequenceDiagram
participant PhotoService as PostLogPhotoRegistrationService
participant Participants as MeetingParticipantRepository
participant Users as UserService
participant Notifications as NotificationService
PhotoService->>Participants: 활성 참여자 조회
PhotoService->>Users: 업로더 닉네임 조회
PhotoService->>Notifications: 참여자별 사진 등록 알림 전달
Loading
sequenceDiagram
participant PostLog as PostLogService
participant Participants as MeetingParticipantRepository
participant Users as UserService
participant Notifications as NotificationService
PostLog->>Participants: 활성 참여자 조회
PostLog->>Users: 작성자 닉네임 조회
PostLog->>Notifications: 작성자를 제외한 수신자별 후기 알림 전달
Loading
Merge Risk:⚪ Minimal · up to 33a3c
This change adds in-app notifications for photo registration and review creation, sent to active meeting participants other than the actor. No concrete merge-blocking risk was found.
Pre-merge checks | 4 | 1
❌ Failed checks (1 warning)
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 6 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name
Status
Explanation
Description check
PR 개요, 작업 내용, 테스트 결과, API 변경, DB 및 설정 변경, 리뷰 참고 사항, 체크리스트를 모두 작성했습니다. 변경 목적과 검증 범위도 구체적입니다.
Title check
제목이 Post-log 사진 등록 및 후기 등록 알림 구현이라는 핵심 변경 사항을 정확하고 간결하게 설명합니다.
Linked Issues check
직접 연결된 #155의 코딩 요구사항을 충족합니다. PostLogPhotoRegistrationService.register()와 PostLogService.createTicket()는 @Transactional 유스케이스 안에서 저장 후 NotificationService.createAll()을 호출합니다. 사진은 새로 저장된 사진이 있을 …
Out of Scope Changes check
변경 사항은 #155의 Post-log 사진 등록 및 후기 생성 알림 범위에 한정됩니다. 알림 명령 객체, 두 유스케이스의 알림 연결, 관련 의존성 조정, 그리고 해당 동작을 검증하는 테스트만 추가 또는 수정되었습니다. 별도 API 형식, 데이터베이스 스키마, 설정, 사진 요청 묶음 처리, 삭제된 사진 알림 처리는 변경하지 않았습니다.
Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
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
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.
개요
PR #140의 Outbox 기반 푸시 발송 인프라에 Post-log 알림 2종을 연결합니다. 각 알림은 사진 등록·티켓(한줄 후기) 생성 트랜잭션 안에서
NotificationService로 앱 내 알림과 Outbox를 함께 저장하고, 실제 푸시는 기존 Outbox Worker가 비동기로 발송합니다.작업 내용
POST_LOG_PHOTOS_REGISTEREDPOST_LOG_REVIEW_CREATEDPostLogNotificationCommands에서 문구와 중복 방지 키를 만듭니다.PreLogNotificationCommands와 같은 형태입니다.POST_LOG_PHOTOS_REGISTERED:{이번 요청에서 새로 저장된 사진 중 최소 사진 ID}:{수신자 ID}POST_LOG_REVIEW_CREATED:{티켓 ID}:{수신자 ID}PostLogPhotoRegistrationService.register()에서 사진을 저장한 직후notifyPhotosRegistered()로 알림을 저장합니다.PostLogService.createTicket()에서 티켓을 저장하고 임시저장을 정리한 뒤notifyReviewCreated()로 알림을 저장합니다.saveDraft())에는 알림을 저장하지 않습니다.MeetingParticipantRepository.findAllActiveWithUserByMeetingId()를 재사용해 조회하고, 행동한 본인은 제외합니다.테스트
PostLogPhotoRegistrationNotificationIntegrationTest(MySQL, 신규): 사진 2장을 한 번에 등록하면 업로더를 제외한 참여자에게 알림과 Outbox가 1건씩 저장되는지(문구, 중복 방지 키,targetId확인), 이미 등록된 사진만 다시 등록하면 알림이 저장되지 않는지PostLogServiceIntegrationTest(MySQL): 티켓 생성 시 작성자를 제외한 참여자에게 알림과 Outbox가 저장되는지, 임시저장이나 티켓 중복 생성에는 알림이 저장되지 않는지PostLogPhotoRegistrationServiceTest(H2): 서비스에 추가된 의존성 연결만 반영했습니다.API 변경
DB 및 설정 변경
NotificationType의POST_LOG_PHOTOS_REGISTERED,POST_LOG_REVIEW_CREATED(→POST_LOG)는 이미 정의되어 있어 변경하지 않았습니다.리뷰 시 참고 사항
findByIdWithGroupForUpdate)으로, 티켓 생성은 유니크 제약으로 중복을 막기 때문에 같은 요청이 동시에 들어와도 알림이 중복 저장되지 않습니다.ON DUPLICATE KEY UPDATE를 H2가 지원하지 않아 알림 검증은 MySQL Testcontainers 테스트에서 수행했습니다.postlog→notification단방향 의존만 추가했습니다.체크리스트
Summary by CodeRabbit