mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 13:52:20 +00:00
feat: scope Telegram reminder tracking to recipients
- keep delegated recipient slots independent\n- bind callback cleanup to the recipient account
This commit is contained in:
1 parent
5807879439
commit
fa46f27b01
6 files changed
+99
-51
No files matched your search
+15
-12
@@ -863,6 +863,7 @@ model User {
|
||||
pushAttemptsForRecord PushAttempt[] @relation("PushAttemptRecordUser")
|
||||
pushAttemptsReceived PushAttempt[] @relation("PushAttemptRecipientUser")
|
||||
notificationEvents NotificationEvent[]
|
||||
telegramReminderMessages TelegramReminderMessage[]
|
||||
// v1.10.3 — per-(user, day) Strain personal-anchor cache (day-total
|
||||
// TRIMP + running EWMA reference) so the nightly Strain engine anchors
|
||||
// the 0–100 map to the user's own training load without re-integrating
|
||||
@@ -3364,24 +3365,26 @@ model ReminderPhaseConfig {
|
||||
}
|
||||
|
||||
model TelegramReminderMessage {
|
||||
id String @id @default(cuid())
|
||||
medicationId String @map("medication_id")
|
||||
scheduleId String @map("schedule_id")
|
||||
chatId String @map("chat_id")
|
||||
messageId Int @map("message_id")
|
||||
phase ReminderPhase
|
||||
sentAt DateTime @default(now()) @map("sent_at")
|
||||
date String // YYYY-MM-DD for day grouping
|
||||
id String @id @default(cuid())
|
||||
recipientUserId String @map("recipient_user_id")
|
||||
medicationId String @map("medication_id")
|
||||
scheduleId String @map("schedule_id")
|
||||
chatId String @map("chat_id")
|
||||
messageId Int @map("message_id")
|
||||
phase ReminderPhase
|
||||
sentAt DateTime @default(now()) @map("sent_at")
|
||||
date String // YYYY-MM-DD for day grouping
|
||||
/// v1.7.0 — time-of-day this reminder belongs to (HH:mm, user-local).
|
||||
/// Empty string = the single legacy window (pre-v1.7 rows + single-time
|
||||
/// schedules). Part of the dedup key so a multi-time schedule dispatches
|
||||
/// once per time-of-day per phase per day instead of once per day.
|
||||
timeOfDay String @default("") @map("time_of_day")
|
||||
timeOfDay String @default("") @map("time_of_day")
|
||||
|
||||
medication Medication @relation(fields: [medicationId], references: [id], onDelete: Cascade)
|
||||
schedule MedicationSchedule @relation(fields: [scheduleId], references: [id], onDelete: Cascade)
|
||||
recipientUser User @relation(fields: [recipientUserId], references: [id], onDelete: Cascade)
|
||||
medication Medication @relation(fields: [medicationId], references: [id], onDelete: Cascade)
|
||||
schedule MedicationSchedule @relation(fields: [scheduleId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([medicationId, scheduleId, date, phase, timeOfDay], map: "telegram_reminder_messages_med_sched_date_phase_tod_key")
|
||||
@@unique([recipientUserId, medicationId, scheduleId, date, phase, timeOfDay], map: "telegram_reminder_messages_recipient_slot_key")
|
||||
@@index([medicationId, date])
|
||||
@@map("telegram_reminder_messages")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user