Conversation
Walkthrough새 JPA 엔티티 PillAlarmRecord와 해당 리포지토리를 추가하고, PillService에 알림 전송 로직을 LocalDate/LocalTime 기반으로 재구성했습니다. 스케줄러에서 알림 중복을 PillAlarmRecord로 제어하며, 삭제 시 PillIntakeRecord와 PillAlarmRecord를 함께 정리합니다. 알림 전송/로그 처리도 갱신되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Scheduler as Scheduler(cron)
participant PillService
participant PillRepository
participant PillIntakeRecordRepo as PillIntakeRecordRepository
participant PillAlarmRecordRepo as PillAlarmRecordRepository
participant FCM as NotificationService
Scheduler->>PillService: checkAndSendMedicationAlarms()
PillService->>PillRepository: find pills where today ∈ intakeDays
PillRepository-->>PillService: pills[]
loop for each pill
loop for each intakeTime
PillService->>PillService: shouldSendAlarm(pill, today, time)
rect rgba(200,230,255,0.3)
PillService->>PillIntakeRecordRepo: existsBy(pill, today, time)?
PillIntakeRecordRepo-->>PillService: boolean
PillService->>PillAlarmRecordRepo: existsByPillAndAlarmDateAndAlarmTime(...)
PillAlarmRecordRepo-->>PillService: boolean
end
alt shouldSendAlarm == true
PillService->>FCM: sendPillAlarmNotification(pill, time)
alt send success
PillService->>PillAlarmRecordRepo: save(new PillAlarmRecord(pill, today, time))
PillAlarmRecordRepo-->>PillService: saved
else send failed
PillService->>PillService: log error
end
else skip
PillService->>PillService: continue
end
end
end
sequenceDiagram
autonumber
actor User as API Caller
participant PillService
participant PillIntakeRecordRepo as PillIntakeRecordRepository
participant PillAlarmRecordRepo as PillAlarmRecordRepository
participant PillRepository
User->>PillService: deletePill(pillId)
PillService->>PillRepository: findById(pillId)
PillRepository-->>PillService: pill
par cleanup records
PillService->>PillIntakeRecordRepo: deleteByPill(pill)
PillService->>PillAlarmRecordRepo: deleteByPill(pill)
end
PillService->>PillRepository: delete(pill)
PillRepository-->>PillService: done
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Free 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (3)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Summary by CodeRabbit
새로운 기능
버그 수정