feat: 견적 확정 및 리뷰 작성 알림 연동 - #61
Conversation
📝 WalkthroughWalkthrough견적 확정과 리뷰 생성 트랜잭션이 완료된 뒤 각각 Changes알림 생성 흐름
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/modules/estimate/estimate.service.ts`:
- Around line 722-729: 트랜잭션 커밋 이후 실행되는 estimate.service.ts의 견적 확정 알림과
review.service.ts의 리뷰 작성 알림을 outbox 또는 재시도 큐로 전달하도록 변경하고, 알림 생성 실패가 도메인 작업의 성공
결과나 API 응답을 덮어쓰지 않게 처리하세요. 두 위치 모두 동일한 비동기 알림 전달·실패 처리 정책을 적용하며, 견적 확정 및 리뷰/통계
커밋 로직은 그대로 성공하도록 유지하세요.
- Around line 724-726: 알림 본문을 사용자에게 표시되는 완결된 문장으로 수정하세요.
src/modules/estimate/estimate.service.ts 724-726의 ESTIMATE_CONFIRMED 알림 content를
“고객님이 견적을 확정했습니다.”와 같은 형태로 변경하고, src/modules/review/review.service.ts 267-268의
리뷰 도착 알림 content도 리뷰 도착을 설명하는 완결된 문장으로 변경하세요.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: f1251eda-db9f-4b93-ac82-0a95df59c09c
📒 Files selected for processing (2)
src/modules/estimate/estimate.service.tssrc/modules/review/review.service.ts
| await notificationService.createNotification({ | ||
| userId: result.estimate.mover.id, | ||
| type: "ESTIMATE_CONFIRMED", | ||
| title: "견적 확정", | ||
| content: "고객님이 견적을 확정", | ||
| linkUrl: "/estimate/received-requests", | ||
| expiresAt: null, | ||
| }); |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
트랜잭션 후 알림 실패를 도메인 작업 실패로 전파하지 않도록 통합 처리해 주세요.
두 서비스 모두 도메인 트랜잭션이 커밋된 뒤 알림 생성 오류를 그대로 전파하므로, 성공한 견적 확정/리뷰 작성이 API 실패로 보이고 재시도 시 충돌이 발생합니다.
src/modules/estimate/estimate.service.ts#L722-L729: 견적 확정 후 알림을 outbox 또는 재시도 큐로 전달하고 알림 실패가 확정 결과를 덮어쓰지 않게 처리해 주세요.src/modules/review/review.service.ts#L264-L271: 리뷰/통계 커밋 후 동일한 알림 전달 및 실패 처리 정책을 적용해 주세요.
📍 Affects 2 files
src/modules/estimate/estimate.service.ts#L722-L729(this comment)src/modules/review/review.service.ts#L264-L271
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/modules/estimate/estimate.service.ts` around lines 722 - 729, 트랜잭션 커밋 이후
실행되는 estimate.service.ts의 견적 확정 알림과 review.service.ts의 리뷰 작성 알림을 outbox 또는 재시도
큐로 전달하도록 변경하고, 알림 생성 실패가 도메인 작업의 성공 결과나 API 응답을 덮어쓰지 않게 처리하세요. 두 위치 모두 동일한 비동기
알림 전달·실패 처리 정책을 적용하며, 견적 확정 및 리뷰/통계 커밋 로직은 그대로 성공하도록 유지하세요.
Source: Path instructions
| userId: estimate.moverId, | ||
| type: "REVIEW_RECEIVED", | ||
| title: "리뷰 도착", | ||
| content: "고객님이", |
There was a problem hiding this comment.
content가 "고객님이"까지만 작성되어 있어 실제 알림에 불완전한 문장이 노출될 것 같습니다.
예를 들어 "고객님이 회원님에게 리뷰를 작성했습니다."와 같이
완성된 문장으로 수정 부탁드립니다.
| type: "ESTIMATE_CONFIRMED", | ||
| title: "견적 확정", | ||
| content: "고객님이 견적을 확정", | ||
| linkUrl: "/estimate/received-requests", |
There was a problem hiding this comment.
알림 문구가 "고객님이 견적을 확정"으로 끝나 문장이 다소 어색한것 같아서 수정이 필요해 보입니다!
예: "고객님이 회원님의 견적을 확정했습니다."
| type: "ESTIMATE_CONFIRMED", | ||
| title: "견적 확정", | ||
| content: "고객님이 견적을 확정", | ||
| linkUrl: "/estimate/received-requests", |
There was a problem hiding this comment.
수신자가 기사인거는 확인했습니다.
다만 linkUrl 이 /estimate/received-requests 로 되어ㅏ있는데 기사가 확정된 견적을 보는 페이지가 맞나요?
맞다면 그냥 넘기셔도됩니다. :)
| title: "견적 확정", | ||
| content: "고객님이 견적을 확정", | ||
| linkUrl: "/estimate/received-requests", | ||
| expiresAt: null, |
There was a problem hiding this comment.
견적 확정 알림의 만료 정책도 이사일 당일 23:59:59(KST)로 정해져 있어서
expiresAt: null 대신 moveDate 기준 만료 시각을 전달해야 할 것 같습니다.
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/modules/estimate/estimate.service.ts (1)
741-748:⚠️ Potential issue | 🟠 Major트랜잭션 후 알림 실패 처리 정책을 두 Service에 통합해 주세요.
두 위치 모두 도메인 트랜잭션이 커밋된 뒤
createNotification을 동기 대기하므로, 알림 장애가 성공한 도메인 작업을 실패 응답으로 바꿉니다. outbox·재시도 큐 또는 알림 실패를 비즈니스 결과와 분리하는 공통 정책을 적용해야 합니다.
src/modules/estimate/estimate.service.ts#L741-L748: 견적 확정 커밋 이후 알림 실패가 확정 결과를 덮어쓰지 않게 처리합니다.src/modules/review/review.service.ts#L264-L271: 리뷰·통계 커밋 이후 알림 실패가 리뷰 결과를 덮어쓰지 않게 동일하게 처리합니다.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/modules/estimate/estimate.service.ts` around lines 741 - 748, Apply one shared post-transaction notification policy to the estimate confirmation flow in src/modules/estimate/estimate.service.ts:741-748 and the review/statistics flow in src/modules/review/review.service.ts:264-271, using an outbox, retry queue, or equivalent common mechanism so createNotification failures cannot change an already-successful business result. Ensure both sites use the same policy and preserve successful transaction responses independently of notification delivery.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@src/modules/estimate/estimate.service.ts`:
- Around line 741-748: Apply one shared post-transaction notification policy to
the estimate confirmation flow in
src/modules/estimate/estimate.service.ts:741-748 and the review/statistics flow
in src/modules/review/review.service.ts:264-271, using an outbox, retry queue,
or equivalent common mechanism so createNotification failures cannot change an
already-successful business result. Ensure both sites use the same policy and
preserve successful transaction responses independently of notification
delivery.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 5d99dade-b879-4091-9e75-6823dd66de05
📒 Files selected for processing (3)
src/modules/estimate/estimate.repository.tssrc/modules/estimate/estimate.service.tssrc/modules/review/review.service.ts
📌 작업 내용
견적 확정과 리뷰 작성 성공 이후 알림이 생성되도록 도메인 Service에서
notificationService.createNotification()을 연동✅ 변경 사항
receivedEstimateService.confirmReceivedEstimateESTIMATE_CONFIRMED알림 생성linkUrl:/estimate/received-requestsreviewService.createReviewREVIEW_RECEIVED알림 생성linkUrl:null🧪 테스트
테스트 방법
npm.cmd run build를 실행했으나, 현재 dev의 기존 알림/공지 모듈 타입 오류로 실패했습니다.📷 스크린샷 (선택)
🔥 체크리스트
🙏 To Reviewer
notificationService.createNotification()을 호출해, 알림 DB 저장 및 SSE 전송은 알림 모듈 내부 흐름을 사용합니다.Summary by CodeRabbit