feat: CoopNotificationService 클래스 추가#2252
Conversation
📝 WalkthroughWalkthroughThe PR refactors dining notification handling by introducing ChangesDining notification service extraction
Sequence DiagramsequenceDiagram
participant CoopEventListener
participant CoopNotificationService
participant NotificationSubscribeRepository
participant NotificationFactory
participant NotificationService
CoopEventListener->>CoopNotificationService: sendDiningSoldOutNotifications(dinningId, place, diningType)
CoopNotificationService->>NotificationSubscribeRepository: find subscribers by type and detail type
NotificationSubscribeRepository-->>CoopNotificationService: subscribers list
CoopNotificationService->>NotificationFactory: create sold-out notifications
NotificationFactory-->>CoopNotificationService: notification objects
CoopNotificationService->>NotificationService: pushNotifications(notifications)
NotificationService-->>CoopNotificationService: delivery complete
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
🧹 Nitpick comments (1)
src/main/java/in/koreatech/koin/domain/notification/service/CoopNotificationService.java (1)
27-36: ⚡ Quick winAdd device token filtering to
sendDiningSoldOutNotificationsfor consistency.While the current code doesn't cause runtime errors (FcmClient handles null tokens gracefully),
sendDiningSoldOutNotificationsshould filter subscribers by device token presence likesendDiningImageUploadNotificationsdoes. This prevents unnecessary FCM calls for users without device tokens and maintains a consistent pattern across the service.🤖 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/in/koreatech/koin/domain/notification/service/CoopNotificationService.java` around lines 27 - 36, The method that builds sold-out notifications uses notificationSubscribeRepository.findAllBySubscribeTypeAndDetailType(...) and maps every subscribe to notificationFactory.generateSoldOutNotification(...), but it should first filter out subscribers whose User.deviceToken is null/empty (same pattern as sendDiningImageUploadNotifications) so we don't create/push notifications for users without tokens; update the stream to .filter(subscribe -> subscribe.getUser() != null && subscribe.getUser().getDeviceToken() != null && !subscribe.getUser().getDeviceToken().isBlank()) before the .map(...) and then call notificationService.pushNotifications(notifications) as before.
🤖 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.
Nitpick comments:
In
`@src/main/java/in/koreatech/koin/domain/notification/service/CoopNotificationService.java`:
- Around line 27-36: The method that builds sold-out notifications uses
notificationSubscribeRepository.findAllBySubscribeTypeAndDetailType(...) and
maps every subscribe to notificationFactory.generateSoldOutNotification(...),
but it should first filter out subscribers whose User.deviceToken is null/empty
(same pattern as sendDiningImageUploadNotifications) so we don't create/push
notifications for users without tokens; update the stream to .filter(subscribe
-> subscribe.getUser() != null && subscribe.getUser().getDeviceToken() != null
&& !subscribe.getUser().getDeviceToken().isBlank()) before the .map(...) and
then call notificationService.pushNotifications(notifications) as before.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 12bbdf97-cc6b-4c94-b289-99b864a2eb37
📒 Files selected for processing (3)
src/main/java/in/koreatech/koin/domain/notification/eventlistener/CoopEventListener.javasrc/main/java/in/koreatech/koin/domain/notification/service/CoopNotificationService.javasrc/main/java/in/koreatech/koin/domain/notification/service/NotificationService.java
💤 Files with no reviewable changes (1)
- src/main/java/in/koreatech/koin/domain/notification/service/NotificationService.java
🔍 개요
🚀 주요 변경 내용
CoopNotificationService 클래스 추가
💬 참고 사항
✅ Checklist (완료 조건)
Summary by CodeRabbit