Update 2 files
This commit is contained in:
1 parent
c84b080fb8
commit
a97794acf8
2 files changed
+10
-2
No files matched your search
@@ -2461,12 +2461,19 @@ model IllnessReport {
|
|||||||
startDate DateTime
|
startDate DateTime
|
||||||
endDate DateTime?
|
endDate DateTime?
|
||||||
documentUrl String? // Medical certificate URL
|
documentUrl String? // Medical certificate URL
|
||||||
|
leaveType String @default("illness") // illness, personal_day, religious_holiday
|
||||||
parentApprovalStatus String @default("pending") // pending, approved, rejected
|
parentApprovalStatus String @default("pending") // pending, approved, rejected
|
||||||
parentApprovedBy String? // userId of approving parent
|
parentApprovedBy String? // userId of approving parent
|
||||||
parentApprovedAt DateTime?
|
parentApprovedAt DateTime?
|
||||||
// Status: only visible to student/parent until approved
|
// Status: only visible to student/parent until approved
|
||||||
isVisibleToTeacher Boolean @default(false)
|
isVisibleToTeacher Boolean @default(false)
|
||||||
isVisibleToAdmin 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
|
status String @default("pending") // pending, approved, rejected, expired
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
@@ -2475,12 +2482,15 @@ model IllnessReport {
|
|||||||
student Student @relation(fields: [studentId], references: [id])
|
student Student @relation(fields: [studentId], references: [id])
|
||||||
reporter User @relation(fields: [reportedBy], references: [id])
|
reporter User @relation(fields: [reportedBy], references: [id])
|
||||||
approver User? @relation("IllnessApprover", fields: [parentApprovedBy], 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([schoolId])
|
||||||
@@index([studentId])
|
@@index([studentId])
|
||||||
@@index([reportedBy])
|
@@index([reportedBy])
|
||||||
@@index([parentApprovalStatus])
|
@@index([parentApprovalStatus])
|
||||||
@@index([status])
|
@@index([status])
|
||||||
|
@@index([adminApprovalStatus])
|
||||||
@@map("illness_reports")
|
@@map("illness_reports")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,8 +43,6 @@ export async function POST(request: Request) {
|
|||||||
if (!parentLink) {
|
if (!parentLink) {
|
||||||
return NextResponse.json({ error: 'You can only approve reports for your children' }, { status: 403 });
|
return NextResponse.json({ error: 'You can only approve reports for your children' }, { status: 403 });
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const newStatus = action === 'approve' ? 'approved' : 'rejected';
|
const newStatus = action === 'approve' ? 'approved' : 'rejected';
|
||||||
const updated = await db.illnessReport.update({
|
const updated = await db.illnessReport.update({
|
||||||
where: { id: reportId },
|
where: { id: reportId },
|
||||||
|
|||||||
Reference in new issue
Block a user