Add educator email invitations and staff notification preferences

This commit is contained in:
t.indorf
2026-10-08 11:32:38 +02:00
parent 043fed2e46
commit 90b8843cda
15 changed files with 700 additions and 39 deletions
+26
View File
@@ -213,6 +213,7 @@ model User {
privacyPolicyVersion String?
/// Zeitstempel des Opt-Ins für das interne Kita-Adressbuch (Modul 3).
directoryOptInAt DateTime?
staffDecisionEmails Boolean @default(true)
// Auth-Bookkeeping
emailVerifiedAt DateTime?
@@ -243,6 +244,7 @@ model User {
auditLogsAuthored AuditLog[] @relation("AuditLogActor")
staffProfile StaffProfile?
staffNotifications StaffNotification[]
staffEmails StaffEmail[]
@@index([kitaId])
@@index([familyId])
@@ -348,11 +350,35 @@ model StaffProfile {
adjustments StaffAdjustment[]
history StaffHistory[]
notifications StaffNotification[]
emails StaffEmail[]
@@index([kitaId])
@@map("staff_profiles")
}
// Persisted in the same transaction as the staff action; delivered after commit.
model StaffEmail {
id String @id @default(cuid())
profileId String
profile StaffProfile @relation(fields: [profileId], references: [id], onDelete: Cascade)
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
toAdmins Boolean @default(false)
subject String
message String
path String
inviteToken String?
createdAt DateTime @default(now())
sentAt DateTime?
skippedAt DateTime?
leaseUntil DateTime?
attempts Int @default(0)
failed Boolean @default(false)
@@index([profileId, sentAt, skippedAt])
@@map("staff_emails")
}
model StaffWorkPattern {
id String @id @default(cuid())
profileId String