Conversation
|
Warning Rate limit exceeded@yooooonshine has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 3 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (3)
요약이 변경사항은 알림 시스템에 새로운 기능을 추가합니다. 변경사항
시퀀스 다이어그램sequenceDiagram
actor User as 사용자
participant PostLikeService as PostLikeService
participant UserRepo as UserEntityRepository
participant LikeRepo as PostLikeRepository
participant NotificationService as NotificationService
User ->> PostLikeService: addLike(postId, userId)
PostLikeService ->> UserRepo: findById(userId)
UserRepo -->> PostLikeService: UserEntity
PostLikeService ->> LikeRepo: save(PostLike)
LikeRepo -->> PostLikeService: PostLike
PostLikeService ->> NotificationService: sendNotification(LIKED, payload)
NotificationService -->> PostLikeService: 알림 전송 완료
PostLikeService -->> User: 좋아요 추가 및 알림 발송 완료
sequenceDiagram
actor User as 사용자
participant AiDerivedPostService as AiDerivedPostService
participant UserRepo as UserEntityRepository
participant PostRepo as PostRepository
participant NotificationService as NotificationService
User ->> AiDerivedPostService: createAiDerivedPost(userId, postId, ...)
AiDerivedPostService ->> UserRepo: findById(userId)
UserRepo -->> AiDerivedPostService: UserEntity
AiDerivedPostService ->> PostRepo: save(DerivedPost)
PostRepo -->> AiDerivedPostService: DerivedPost
AiDerivedPostService ->> NotificationService: sendNotification(DERIVED_POST_CREATED, payload)
NotificationService -->> AiDerivedPostService: 알림 전송 완료
AiDerivedPostService -->> User: 파생 게시물 생성 및 알림 발송 완료
예상 코드 리뷰 노력🎯 3 (중간 복잡도) | ⏱️ ~20분
관련 PR
시
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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: 1
🧹 Nitpick comments (2)
src/main/java/hanium/modic/backend/domain/postLike/service/PostLikeService.java (1)
80-89: 분산 락 내부에서 알림 생성을 고려하세요.현재 알림 생성이 분산 락 내부에서 동기적으로 실행되어 좋아요와 알림의 원자성을 보장합니다. 그러나 이로 인해 락을 보유하는 시간이 길어져 처리량에 영향을 줄 수 있습니다.
만약 알림 생성 지연이 성능 문제를 일으킨다면,
TransactionSynchronization을 사용하여 트랜잭션 커밋 후 알림을 비동기로 전송하는 것을 고려해보세요. (단, 이 경우 원자성 보장이 약화됩니다)src/main/java/hanium/modic/backend/domain/notification/enums/NotificationType.java (1)
88-95: 제목과 본문을 구별하는 것을 고려하세요.현재 LIKED 알림의 제목과 본문이 동일한 메시지를 사용하고 있습니다. 사용자 경험 향상을 위해 제목은 간결하게, 본문은 상세하게 작성하는 것을 고려해보세요.
예시:
- 제목: "새로운 좋아요"
- 본문: "님이 '{게시글제목}' 게시글에 좋아요를 눌렀습니다."
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/main/java/hanium/modic/backend/domain/notification/dto/GetNotificationsResponse.java(2 hunks)src/main/java/hanium/modic/backend/domain/notification/enums/NotificationType.java(3 hunks)src/main/java/hanium/modic/backend/domain/post/service/AiDerivedPostService.java(4 hunks)src/main/java/hanium/modic/backend/domain/postLike/service/PostLikeService.java(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (7)
src/main/java/hanium/modic/backend/domain/postLike/service/PostLikeService.java (2)
4-4: LGTM!알림 기능을 위한 의존성 추가가 적절하게 구성되었습니다.
Also applies to: 16-19, 45-46
57-58: LGTM!분산 락 획득 전 사용자 존재 여부를 미리 검증하여 불필요한 락 획득을 방지하는 좋은 설계입니다.
src/main/java/hanium/modic/backend/domain/notification/enums/NotificationType.java (1)
52-52: LGTM!알림 메시지가 더 명확하고 일관성 있게 개선되었습니다.
Also applies to: 64-64, 76-76, 82-82
src/main/java/hanium/modic/backend/domain/post/service/AiDerivedPostService.java (3)
15-17: LGTM!알림 기능 및 사용자 검증을 위한 의존성이 올바르게 추가되었습니다.
Also applies to: 24-25, 33-33, 52-52, 55-55, 58-58
81-82: LGTM!파생 포스트 생성 전 사용자 존재 여부를 조기에 검증하여 불필요한 작업을 방지하는 좋은 설계입니다.
171-179: LGTM!파생 포스트 생성 시 원작자에게 알림을 전송하는 로직이 올바르게 구현되었습니다. 알림 페이로드의 수신자와 발신자 정보가 정확합니다.
src/main/java/hanium/modic/backend/domain/notification/dto/GetNotificationsResponse.java (1)
16-16: 모든 알림 타입에서 senderId 제공 확인 완료검증 결과, 모든 알림 타입에서 senderId를 올바르게 제공하고 있습니다.
- COIN_RECEIVED (AccountService): fromUserId 제공 ✓
- POST_PURCHASED_BY_COIN (AiImagePermissionService): userId 제공 ✓
- POST_PURCHASED_BY_TICKET (AiImagePermissionService): userId 제공 ✓
- POST_REVIEWED (PostReviewService): user.getId() 제공 ✓
- LIKED (PostLikeService): user.getId() 제공 ✓
- DERIVED_POST_CREATED (AiDerivedPostService): user.getId() 제공 ✓
- FOLLOWED (FollowService): me.getId() 제공 ✓
NotificationPayload는 직렬화되어 저장되고, 조회 시 역직렬화되어 GetNotificationsResponse로 매핑됩니다. senderId는 응답에 항상 포함되므로, 프론트엔드에서 추가 처리가 필요 없습니다.
개요
작업사항
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.