Refactor/#172 알림 엔티티 구조 개선 - 알림 관련 엔티티와 알림 설정 API 개선#173
Conversation
…, 봇 클릭, 리포트 알림 필드 추가 및 비즈니스 메서드 수정
|
Warning Review limit reached
Next review available in: 40 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Walkthrough개인 알림 설정과 조직 외부 채널 설정을 분리하고, 봇 클릭·리포트·클릭 급증 알림 유형을 추가했습니다. 조직 설정 API와 유형별 Slack·Discord 전송 검사가 구현됐으며, 예산 알림 필드는 제거됐습니다. Changes알림 설정 및 전송 흐름
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant NotificationController
participant NotificationServiceImpl
participant OrgNotificationSetting
participant SlackDiscord
Client->>NotificationController: 조직 설정 PATCH 요청
NotificationController->>NotificationServiceImpl: updateOrgSettings(userId, orgId, request)
NotificationServiceImpl->>OrgNotificationSetting: 채널 및 알림 유형 설정 갱신
Client->>NotificationServiceImpl: sendApiAlarmToOrg(orgId, type, title, message)
NotificationServiceImpl->>OrgNotificationSetting: 알림 유형 활성화 여부 확인
NotificationServiceImpl->>SlackDiscord: 활성화된 알림 전송
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/com/whereyouad/WhereYouAd/domains/notification/presentation/docs/NotificationControllerDocs.java (1)
40-44: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
updateChannels의 400 응답 코드가 구현과 불일치합니다 — 정리가 필요합니다.
@Operationdescription은 "브라우저 푸시, 이메일"로 올바르게 업데이트했지만,@ApiResponses의 400 응답 코드(NOTIFICATION_400_2: URL 없이 알림 활성화,NOTIFICATION_400_3: 활성화+연결해제 동시 요청)는 여전히 남아있습니다. 이 URL 관련 에러들은 이제updateOrgSettings(line 68)로 이동되었으며,updateChannels서비스 구현에는 URL 검증이나 충돌 체크 로직이 없습니다. API 사용자가 잘못된 400 응답을 예상하게 됩니다.📝 제안: updateChannels 400 응답 코드 제거
`@Operation`(summary = "알림 채널 설정 변경", description = "회원 개인의 브라우저 푸시, 이메일 알림 채널을 설정합니다.") `@ApiResponses`({ `@ApiResponse`(responseCode = "200", description = "변경 성공"), - `@ApiResponse`(responseCode = "400", description = "NOTIFICATION_400_2: URL 없이 알림 활성화\n\n NOTIFICATION_400_3 : 활성화+연결해제 동시 요청"), `@ApiResponse`(responseCode = "404", description = "해당 조직의 멤버가 아닙니다.") })🤖 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/main/java/com/whereyouad/WhereYouAd/domains/notification/presentation/docs/NotificationControllerDocs.java` around lines 40 - 44, NotificationControllerDocs의 updateChannels 문서에 구현되지 않은 URL 검증 및 충돌 관련 400 응답 코드가 남아 있습니다. updateChannels의 `@ApiResponses에서` NOTIFICATION_400_2와 NOTIFICATION_400_3 설명을 제거하고, 실제 서비스 구현과 일치하는 응답만 유지하세요.
🤖 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/main/java/com/whereyouad/WhereYouAd/domains/notification/persistence/entity/OrgMemberNotificationSetting.java`:
- Around line 34-41: OrgMemberNotificationSetting의 alertRapidClicks,
alertBotClicks, alertReport 컬럼에 기존 데이터와의 호환을 위한 기본값을 추가하세요. 각 필드에
`@ColumnDefault`("false")를 적용하거나, 동등한 마이그레이션에서 해당 컬럼의 DB 기본값을 false로 명시하고 nullable
= false 설정은 유지하세요.
In
`@src/main/java/com/whereyouad/WhereYouAd/domains/notification/persistence/entity/OrgNotificationSetting.java`:
- Around line 41-48: OrgNotificationSetting의 alertRapidClicks, alertBotClicks,
alertReport 필드에 기존 isSlackEnabled 및 isDiscordEnabled와 동일하게
`@ColumnDefault`("false")를 추가하세요.
---
Outside diff comments:
In
`@src/main/java/com/whereyouad/WhereYouAd/domains/notification/presentation/docs/NotificationControllerDocs.java`:
- Around line 40-44: NotificationControllerDocs의 updateChannels 문서에 구현되지 않은 URL
검증 및 충돌 관련 400 응답 코드가 남아 있습니다. updateChannels의 `@ApiResponses에서`
NOTIFICATION_400_2와 NOTIFICATION_400_3 설명을 제거하고, 실제 서비스 구현과 일치하는 응답만 유지하세요.
🪄 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
Run ID: af23fb87-d794-4e53-a9fa-08d25f1631ba
📒 Files selected for processing (10)
src/main/java/com/whereyouad/WhereYouAd/domains/notification/application/dto/request/NotificationRequest.javasrc/main/java/com/whereyouad/WhereYouAd/domains/notification/application/dto/response/NotificationResponse.javasrc/main/java/com/whereyouad/WhereYouAd/domains/notification/application/mapper/NotificationConverter.javasrc/main/java/com/whereyouad/WhereYouAd/domains/notification/domain/constant/NotificationType.javasrc/main/java/com/whereyouad/WhereYouAd/domains/notification/domain/service/NotificationService.javasrc/main/java/com/whereyouad/WhereYouAd/domains/notification/domain/service/NotificationServiceImpl.javasrc/main/java/com/whereyouad/WhereYouAd/domains/notification/persistence/entity/OrgMemberNotificationSetting.javasrc/main/java/com/whereyouad/WhereYouAd/domains/notification/persistence/entity/OrgNotificationSetting.javasrc/main/java/com/whereyouad/WhereYouAd/domains/notification/presentation/NotificationController.javasrc/main/java/com/whereyouad/WhereYouAd/domains/notification/presentation/docs/NotificationControllerDocs.java
📌 관련 이슈
🚀 개요
7월 9일 회의 내용에 따라 기존 예산 소진율을 반영하던 알림 엔티티에서 클릭수 관련 알림 수신 여부와 리포트 수신 여부로 엔티티 필드를 개선하고, 기존 알림 설정 API 를 엔티티 개선에 맞춰 수정합니다.

📄 작업 내용
📸 스크린샷 / 테스트 결과 (선택)
크게 두가지 작업 내용으로 보면 될거 같습니다...!
7월 9일 회의 내용에 따라 기존에 OrgMemberNotificationSetting 내부 예산 관련 필드를 제거하고, 클릭수 급증, 봇 클릭, 리포트 알림 필드로 수정진행 & 관련 로직 수정 42a193a ~ 3913007
OrgNotificationSetting 엔티티에서 조직 단위로 외부채널(슬랙, 디스코드) 에 알림을 보낼때도 어떤 알림을 보낼지 (클릭수 급증, 봇 클릭, 리포트 알림) 설정 및 구분이 필요하다고 판단되어 관련 필드를 추가했습니다.
또한, 기존에 NotificationServiceImpl 내부 updateChannels 메서드에서 회원 개인의 브라우저 푸시, 이메일 푸시 여부와 ADMIN 이면 조직의 슬랙, 디스코드 웹훅 URL 까지 설정하던걸 별도의 API (PATCH /api/notification/settings/{orgId}/org) updateOrgSettings 메서드로 분리하여 updateOrgSettings 메서드에서 조직 외부 채널에 어떤 알림을 받을지 (클릭수 급증, 봇 클릭, 리포트 알림) 설정하는 것과 웹훅 URL 을 업데이트 하도록 수정했습니다.
d62feea ~ fc3e4b6
웹훅 URL 입력 로직이 삭제된 (PATCH /api/notification/settings/{orgId}/channels) 동작 확인



새로 추가된 API

정상 응답 확인 및 DB 정상 저장 확인


알림 발송 테스트 정상 동작 확인



ERD 업데이트


+++

추가로 application.yml 의 ddl-auth : update 로는 필드 추가는 정상 반영하지만 필드 제거는 반영하지 않는 거 같아서, 머지 후 배포 DB 확인하여 SQL 로 수동 삭제 예정입니다.
✅ 체크리스트
🔍 리뷰 포인트 (Review Points)
Summary by CodeRabbit
새로운 기능
변경 사항