feat: complete notdienst planning, quick wins and notifications
This commit is contained in:
+49
-1
@@ -159,7 +159,9 @@ model Kita {
|
||||
termine Termin[]
|
||||
mitbringselItems MitbringselItem[]
|
||||
eventParticipations EventParticipation[]
|
||||
notdienstPlans NotdienstPlan[]
|
||||
notdienstEmails NotdienstEmail[]
|
||||
notdienstReminderRuns NotdienstReminderRun[]
|
||||
notdienstPlans NotdienstPlan[]
|
||||
notdienstAvailabilities NotdienstAvailability[]
|
||||
notdienstAssignments NotdienstAssignment[]
|
||||
notdienstAlerts NotdienstAlert[]
|
||||
@@ -184,6 +186,7 @@ model Family {
|
||||
|
||||
name String
|
||||
notdienstAlarms NotdienstAlarm[]
|
||||
notdienstEmails NotdienstEmail[]
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
@@ -275,6 +278,7 @@ model User {
|
||||
alarmRecipients NotdienstAlarmRecipient[]
|
||||
alarmNotifications NotdienstAlarmNotification[]
|
||||
alarmEmails NotdienstAlarmEmail[]
|
||||
notdienstEmails NotdienstEmail[]
|
||||
|
||||
@@index([kitaId])
|
||||
@@index([familyId])
|
||||
@@ -902,6 +906,7 @@ model NotdienstPlan {
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
assignments NotdienstAssignment[]
|
||||
emails NotdienstEmail[]
|
||||
|
||||
@@unique([kitaId, year, month])
|
||||
@@index([kitaId])
|
||||
@@ -1208,3 +1213,46 @@ model PendingRegistration {
|
||||
@@index([expiresAt])
|
||||
@@map("pending_registrations")
|
||||
}
|
||||
|
||||
/// Durable notification jobs. No bearer tokens or personal response links.
|
||||
model NotdienstEmail {
|
||||
id String @id @default(cuid())
|
||||
kitaId String
|
||||
kita Kita @relation(fields: [kitaId], references: [id], onDelete: Cascade)
|
||||
familyId String
|
||||
family Family @relation(fields: [familyId], references: [id], onDelete: Cascade)
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
planId String?
|
||||
plan NotdienstPlan? @relation(fields: [planId], references: [id], onDelete: Cascade)
|
||||
year Int
|
||||
month Int
|
||||
kind String
|
||||
eventKey String
|
||||
createdAt DateTime @default(now())
|
||||
sentAt DateTime?
|
||||
skippedAt DateTime?
|
||||
leaseUntil DateTime?
|
||||
claimToken String?
|
||||
nextAttemptAt DateTime @default(now())
|
||||
failed Boolean @default(false)
|
||||
attempts Int @default(0)
|
||||
lastError String?
|
||||
|
||||
@@unique([kitaId, userId, kind, year, month, eventKey])
|
||||
@@index([sentAt, skippedAt, nextAttemptAt])
|
||||
@@index([kitaId, year, month])
|
||||
@@map("notdienst_emails")
|
||||
}
|
||||
|
||||
model NotdienstReminderRun {
|
||||
id String @id @default(cuid())
|
||||
kitaId String
|
||||
kita Kita @relation(fields: [kitaId], references: [id], onDelete: Cascade)
|
||||
year Int
|
||||
month Int
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@unique([kitaId, year, month])
|
||||
@@map("notdienst_reminder_runs")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user