Update 2 files

This commit is contained in:
[dyad] committed 2026-08-02 14:01:30 +02:00
1 parent c84b080fb8
commit a97794acf8
2 files changed
+10 -2

No files matched your search

+10
View File
@@ -2461,12 +2461,19 @@ model IllnessReport {
startDate DateTime
endDate DateTime?
documentUrl String? // Medical certificate URL
leaveType String @default("illness") // illness, personal_day, religious_holiday
parentApprovalStatus String @default("pending") // pending, approved, rejected
parentApprovedBy String? // userId of approving parent
parentApprovedAt DateTime?
// Status: only visible to student/parent until approved
isVisibleToTeacher Boolean @default(false)
isVisibleToAdmin Boolean @default(false)
teacherNotifiedAt DateTime?
adminApprovalStatus String @default("pending") // pending, approved, rejected
adminApprovedBy String?
adminApprovedAt DateTime?
adminNotes String?
calendarEventId String? @unique
status String @default("pending") // pending, approved, rejected, expired
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@ -2475,12 +2482,15 @@ model IllnessReport {
student Student @relation(fields: [studentId], references: [id])
reporter User @relation(fields: [reportedBy], references: [id])
approver User? @relation("IllnessApprover", fields: [parentApprovedBy], references: [id])
adminApprover User? @relation("IllnessAdminApprover", fields: [adminApprovedBy], references: [id])
calendarEvent CalendarEvent? @relation(fields: [calendarEventId], references: [id])
@@index([schoolId])
@@index([studentId])
@@index([reportedBy])
@@index([parentApprovalStatus])
@@index([status])
@@index([adminApprovalStatus])
@@map("illness_reports")
}
@@ -43,8 +43,6 @@ export async function POST(request: Request) {
if (!parentLink) {
return NextResponse.json({ error: 'You can only approve reports for your children' }, { status: 403 });
}
}
const newStatus = action === 'approve' ? 'approved' : 'rejected';
const updated = await db.illnessReport.update({
where: { id: reportId },