Skip to content

feat: CoopNotificationService 클래스 추가#2252

Open
Soundbar91 wants to merge 7 commits into
developfrom
feat/2251-add-coop-notification-service
Open

feat: CoopNotificationService 클래스 추가#2252
Soundbar91 wants to merge 7 commits into
developfrom
feat/2251-add-coop-notification-service

Conversation

@Soundbar91
Copy link
Copy Markdown
Collaborator

@Soundbar91 Soundbar91 commented May 20, 2026

🔍 개요


🚀 주요 변경 내용

CoopNotificationService 클래스 추가

  • Coop 관련 도메인의 알림을 담당하는 클래스를 추가했습니다.
  • 관련 EventListener 클래스, NotificationService에 있는 Coop 관련 비즈니스 로직을 옮겼습니다.

💬 참고 사항


✅ Checklist (완료 조건)

  • 코드 스타일 가이드 준수
  • 테스트 코드 포함됨
  • Reviewers / Assignees / Labels 지정 완료
  • 보안 및 민감 정보 검증 (API 키, 환경 변수, 개인정보 등)

Summary by CodeRabbit

  • Refactor
    • Reorganized notification service architecture to improve code structure and maintainability within the notification system.

Review Change Stack

@Soundbar91 Soundbar91 self-assigned this May 20, 2026
@github-actions github-actions Bot added the 공통 백엔드 공통으로 작업할 이슈입니다. label May 20, 2026
@github-actions github-actions Bot requested review from BaeJinho4028 and ImTotem May 20, 2026 11:06
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

📝 Walkthrough

Walkthrough

The PR refactors dining notification handling by introducing CoopNotificationService, which centralizes subscriber lookup, notification generation, and delivery for dining-specific events. CoopEventListener is updated to delegate to this new service, and NotificationService is cleaned up by removing the dining-sold-out method and its factory dependency.

Changes

Dining notification service extraction

Layer / File(s) Summary
CoopNotificationService implementation
src/main/java/in/koreatech/koin/domain/notification/service/CoopNotificationService.java
New Spring service with @Transactional(readOnly = true) and constructor injection for NotificationSubscribeRepository, NotificationFactory, and NotificationService. Exposes sendDiningSoldOutNotifications which derives detail type from DiningType, queries matching subscribers, generates notifications via factory, and pushes them. Also exposes sendDiningImageUploadNotifications which queries subscribers, filters by device token, generates upload notifications, and pushes them.
CoopEventListener delegation
src/main/java/in/koreatech/koin/domain/notification/eventlistener/CoopEventListener.java
Updates dependency injection to use CoopNotificationService instead of NotificationService, NotificationSubscribeRepository, and NotificationFactory. Both event handler methods (onDiningSoldOutRequest and onDiningImageUploadRequest) are simplified to single-line delegates to the new service.
NotificationService cleanup
src/main/java/in/koreatech/koin/domain/notification/service/NotificationService.java
Removes sendDiningSoldOutNotifications method, removes NotificationFactory constructor-injected field, removes dining-related static imports, and updates type imports to notification-domain utilities. Preserves internal delivery flow and helper methods.

Sequence Diagram

sequenceDiagram
  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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • ImTotem
  • dh2906
  • BaeJinho4028
  • krSeonghyeon

Poem

🐰 A service is born, so shiny and new,
Dining notifications know just what to do,
Events point the way, clean and so light,
Refactored with care, everything's right! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: addition of the CoopNotificationService class, which is the primary objective of this PR.
Linked Issues check ✅ Passed The PR successfully implements the objective from issue #2251 by adding CoopNotificationService to handle Coop domain notifications and separating the logic from NotificationService.
Out of Scope Changes check ✅ Passed All changes are directly related to the stated objective: adding CoopNotificationService, refactoring CoopEventListener to use it, and removing the moved logic from NotificationService.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feat/2251-add-coop-notification-service

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.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/main/java/in/koreatech/koin/domain/notification/service/CoopNotificationService.java (1)

27-36: ⚡ Quick win

Add device token filtering to sendDiningSoldOutNotifications for consistency.

While the current code doesn't cause runtime errors (FcmClient handles null tokens gracefully), sendDiningSoldOutNotifications should filter subscribers by device token presence like sendDiningImageUploadNotifications does. 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

📥 Commits

Reviewing files that changed from the base of the PR and between 915ffe1 and 88e97ae.

📒 Files selected for processing (3)
  • src/main/java/in/koreatech/koin/domain/notification/eventlistener/CoopEventListener.java
  • src/main/java/in/koreatech/koin/domain/notification/service/CoopNotificationService.java
  • src/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

@github-actions
Copy link
Copy Markdown

Unit Test Results

672 tests  ±0   669 ✔️ ±0   1m 17s ⏱️ ±0s
166 suites ±0       3 💤 ±0 
166 files   ±0       0 ±0 

Results for commit 88e97ae. ± Comparison against base commit 915ffe1.

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

Labels

공통 백엔드 공통으로 작업할 이슈입니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[공통] CoopNotificationService 추가

1 participant