Add superadmin audit and Kita management
This commit is contained in:
@@ -68,6 +68,11 @@ enum EventParticipationStatus {
|
||||
NOT_ATTENDING
|
||||
}
|
||||
|
||||
enum AuditTargetType {
|
||||
KITA
|
||||
USER
|
||||
}
|
||||
|
||||
enum NotdienstPlanStatus {
|
||||
DRAFT
|
||||
PUBLISHED
|
||||
@@ -222,6 +227,7 @@ model User {
|
||||
|
||||
mitbringselItems MitbringselItem[]
|
||||
invitationsCreated Invitation[] @relation("InvitationCreator")
|
||||
auditLogsAuthored AuditLog[] @relation("AuditLogActor")
|
||||
|
||||
@@index([kitaId])
|
||||
@@index([familyId])
|
||||
@@ -687,6 +693,36 @@ model NotdienstAlert {
|
||||
@@map("notdienst_alerts")
|
||||
}
|
||||
|
||||
// =====================================================================
|
||||
// AUDIT LOGS (Systemweite Superadmin-Aktionen)
|
||||
// =====================================================================
|
||||
|
||||
/// Persistente Spur fuer Superadmin-Support-Aktionen.
|
||||
/// Zielobjekte werden bewusst nur als Snapshot gespeichert, damit Logs auch
|
||||
/// nach einer Kita- oder Benutzerloeschung erhalten bleiben.
|
||||
model AuditLog {
|
||||
id String @id @default(cuid())
|
||||
|
||||
actorUserId String?
|
||||
actorUser User? @relation("AuditLogActor", fields: [actorUserId], references: [id], onDelete: SetNull)
|
||||
actorEmail String
|
||||
|
||||
action String
|
||||
targetType AuditTargetType
|
||||
targetId String
|
||||
targetLabel String
|
||||
targetKitaId String?
|
||||
|
||||
metadata Json?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([actorUserId])
|
||||
@@index([targetType, targetId])
|
||||
@@index([targetKitaId])
|
||||
@@index([createdAt])
|
||||
@@map("audit_logs")
|
||||
}
|
||||
|
||||
// =====================================================================
|
||||
// AUTH-HILFSTABELLE
|
||||
// =====================================================================
|
||||
|
||||
Reference in New Issue
Block a user