Skip to content

feat: 견적 확정 및 리뷰 작성 알림 연동 - #61

Merged
Obebe-creator merged 2 commits into
devfrom
feature/connect-notifications-estimate-review
Jul 30, 2026
Merged

feat: 견적 확정 및 리뷰 작성 알림 연동#61
Obebe-creator merged 2 commits into
devfrom
feature/connect-notifications-estimate-review

Conversation

@Obebe-creator

@Obebe-creator Obebe-creator commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

📌 작업 내용

견적 확정과 리뷰 작성 성공 이후 알림이 생성되도록 도메인 Service에서 notificationService.createNotification()을 연동

✅ 변경 사항

  • receivedEstimateService.confirmReceivedEstimate

    • 고객이 받은 견적을 확정한 뒤 기사에게 ESTIMATE_CONFIRMED 알림 생성
    • 견적 확정 transaction이 완료된 이후 알림 생성
    • linkUrl: /estimate/received-requests
  • reviewService.createReview

    • 고객이 리뷰를 작성한 뒤 기사에게 REVIEW_RECEIVED 알림 생성
    • 리뷰 생성 및 기사 리뷰 통계 갱신 transaction이 완료된 이후 알림 생성
    • linkUrl: null

🧪 테스트

  • 서버 실행 확인
  • API 동작 확인
  • DB 연동 확인
  • 로그 확인
  • 기타: 변경 파일 ESLint 확인

테스트 방법

  1. 아래 명령어로 변경 파일 ESLint 검증을 실행했습니다.
npx.cmd eslint src/modules/estimate/estimate.service.ts src/modules/review/review.service.ts
  1. ESLint 에러가 없는 것을 확인했습니다.
  2. npm.cmd run build를 실행했으나, 현재 dev의 기존 알림/공지 모듈 타입 오류로 실패했습니다.

📷 스크린샷 (선택)

🔥 체크리스트

  • 코드 컨벤션을 준수했습니다.
  • 불필요한 console.log를 제거했습니다.
  • ESLint 오류가 없습니다.
  • 변경 사항을 직접 테스트했습니다.
  • 관련 문서를 업데이트했습니다. (필요 시)

🙏 To Reviewer

  • 알림 생성은 Controller가 아니라 각 도메인 Service에서 호출하도록 적용했습니다.
  • 비즈니스 transaction이 성공한 이후 notificationService.createNotification()을 호출해, 알림 DB 저장 및 SSE 전송은 알림 모듈 내부 흐름을 사용합니다.

Summary by CodeRabbit

  • 새 기능
    • 견적 확정 시 ‘견적을 확정했습니다.’ 알림이 생성되고, 만료 시간은 이동일 기준 KST 하루 말(23:59:59.999)로 적용됩니다. 알림함에서는 만료 전까지 확인할 수 있습니다.
    • 리뷰 등록 시 기사님에게 ‘리뷰 도착’ 알림이 전송되며, 내용은 ‘고객님이 회원님에게 리뷰를 작성했습니다.’로 표시됩니다.
  • 알림 표시 타이밍 개선
    • 처리 완료 후에 알림이 반영되어 표시 누락 가능성이 줄었습니다.
  • 알림 문구 개선
    • 알림 문구가 문장형으로 정리되어 읽기 쉬워졌습니다.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

견적 확정과 리뷰 생성 트랜잭션이 완료된 뒤 각각 ESTIMATE_CONFIRMED, REVIEW_RECEIVED 알림을 생성합니다. 견적 확정 알림의 만료일은 이사 날짜 기준 KST 일말로 계산됩니다.

Changes

알림 생성 흐름

Layer / File(s) Summary
견적 확정 알림 및 만료일 처리
src/modules/estimate/estimate.repository.ts, src/modules/estimate/estimate.service.ts
확정 결과에 moveDate를 포함하고, 트랜잭션 종료 후 이사 날짜 기준 만료일을 적용한 ESTIMATE_CONFIRMED 알림을 생성합니다.
리뷰 수신 알림 처리
src/modules/review/review.service.ts
리뷰 및 기사님 통계 갱신 트랜잭션 완료 후 기사님에게 REVIEW_RECEIVED 알림을 생성합니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: soooob43

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 견적 확정/리뷰 작성 완료 후 알림 연동이라는 핵심 변경을 짧고 명확하게 담고 있습니다.
Description check ✅ Passed 필수 섹션인 작업 내용, 변경 사항, 테스트, 체크리스트, To Reviewer가 모두 포함되어 템플릿을 충족합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/connect-notifications-estimate-review

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between a3eb8e2 and 472d68d.

📒 Files selected for processing (2)
  • src/modules/estimate/estimate.service.ts
  • src/modules/review/review.service.ts

Comment on lines +722 to +729
await notificationService.createNotification({
userId: result.estimate.mover.id,
type: "ESTIMATE_CONFIRMED",
title: "견적 확정",
content: "고객님이 견적을 확정",
linkUrl: "/estimate/received-requests",
expiresAt: null,
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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

Comment thread src/modules/estimate/estimate.service.ts Outdated
Comment thread src/modules/review/review.service.ts Outdated
userId: estimate.moverId,
type: "REVIEW_RECEIVED",
title: "리뷰 도착",
content: "고객님이",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

content"고객님이"까지만 작성되어 있어 실제 알림에 불완전한 문장이 노출될 것 같습니다.

예를 들어 "고객님이 회원님에게 리뷰를 작성했습니다."와 같이
완성된 문장으로 수정 부탁드립니다.

type: "ESTIMATE_CONFIRMED",
title: "견적 확정",
content: "고객님이 견적을 확정",
linkUrl: "/estimate/received-requests",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

알림 문구가 "고객님이 견적을 확정"으로 끝나 문장이 다소 어색한것 같아서 수정이 필요해 보입니다!

예: "고객님이 회원님의 견적을 확정했습니다."

type: "ESTIMATE_CONFIRMED",
title: "견적 확정",
content: "고객님이 견적을 확정",
linkUrl: "/estimate/received-requests",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수신자가 기사인거는 확인했습니다.
다만 linkUrl 이 /estimate/received-requests 로 되어ㅏ있는데 기사가 확정된 견적을 보는 페이지가 맞나요?

맞다면 그냥 넘기셔도됩니다. :)

title: "견적 확정",
content: "고객님이 견적을 확정",
linkUrl: "/estimate/received-requests",
expiresAt: null,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

견적 확정 알림의 만료 정책도 이사일 당일 23:59:59(KST)로 정해져 있어서
expiresAt: null 대신 moveDate 기준 만료 시각을 전달해야 할 것 같습니다.

@Obebe-creator
Obebe-creator merged commit edcc6d1 into dev Jul 30, 2026
1 check was pending

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ 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

📥 Commits

Reviewing files that changed from the base of the PR and between 472d68d and 5b34f97.

📒 Files selected for processing (3)
  • src/modules/estimate/estimate.repository.ts
  • src/modules/estimate/estimate.service.ts
  • src/modules/review/review.service.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants