Fix: Prisma schema - add missing relation fields for ClassMessagingLock and EscalationPolicy

- Added schoolId field and school relation to ClassMessagingLock model
- Added escalationPoliciesOverridden to User model
- Added classMessagingLocksLocked to User model
- Added classMessagingLocks relation to ClassGroup model
- Added relation names to avoid ambiguity
This commit is contained in:
Z User committed 2026-08-10 15:46:49 +00:00
1 parent 59fcecedee
commit 9b9115cb73
1 file changed
+8 -2
+8 -2
View File
@@ -247,6 +247,8 @@ model User {
// Module J widgets relations // Module J widgets relations
dashboardWidgets DashboardWidget[] dashboardWidgets DashboardWidget[]
dashboardLayouts DashboardLayout[] dashboardLayouts DashboardLayout[]
escalationPoliciesOverridden EscalationPolicy[] @relation("EscalationOverriddenBy")
classMessagingLocksLocked ClassMessagingLock[] @relation("ClassMessagingLockLockedBy")
passwordResetTokens PasswordResetToken[] passwordResetTokens PasswordResetToken[]
twoFactorRecoveryCodes TwoFactorRecoveryCode[] twoFactorRecoveryCodes TwoFactorRecoveryCode[]
} }
@@ -336,6 +338,7 @@ model ClassGroup {
examPlans ExamPlan[] examPlans ExamPlan[]
seatingCharts SeatingChart[] seatingCharts SeatingChart[]
substitutionAssignments SubstitutionAssignment[] substitutionAssignments SubstitutionAssignment[]
classMessagingLocks ClassMessagingLock[]
} }
model ClassGroupTeacher { model ClassGroupTeacher {
@@ -3740,7 +3743,7 @@ model EscalationPolicy {
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt
school School @relation(fields: [schoolId], references: [id]) school School @relation(fields: [schoolId], references: [id])
overriddenByUser User? @relation(fields: [overriddenByUserId], references: [id]) overriddenByUser User? @relation("EscalationOverriddenBy", fields: [overriddenByUserId], references: [id])
@@index([schoolId]) @@index([schoolId])
@@index([fromRole, toRole]) @@index([fromRole, toRole])
@@ -3750,6 +3753,7 @@ model EscalationPolicy {
model ClassMessagingLock { model ClassMessagingLock {
id String @id @default(cuid()) id String @id @default(cuid())
classGroupId String classGroupId String
schoolId String
lockedByUserId String // teacher who locked lockedByUserId String // teacher who locked
lockedFrom DateTime lockedFrom DateTime
lockedUntil DateTime? // nullable = "until class ends" lockedUntil DateTime? // nullable = "until class ends"
@@ -3758,9 +3762,11 @@ model ClassMessagingLock {
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt
classGroup ClassGroup @relation(fields: [classGroupId], references: [id]) classGroup ClassGroup @relation(fields: [classGroupId], references: [id])
lockedByUser User @relation(fields: [lockedByUserId], references: [id]) school School @relation(fields: [schoolId], references: [id])
lockedByUser User @relation("ClassMessagingLockLockedBy", fields: [lockedByUserId], references: [id])
@@index([classGroupId]) @@index([classGroupId])
@@index([schoolId])
@@index([lockedByUserId]) @@index([lockedByUserId])
@@index([lockedFrom, lockedUntil]) @@index([lockedFrom, lockedUntil])
@@map("class_messaging_locks") @@map("class_messaging_locks")