Add 4 files, update 15 files

This commit is contained in:
[dyad] committed 2026-08-02 15:17:18 +02:00
1 parent a97794acf8
commit 2db87a1227
19 files changed
+414 -33

No files matched your search

+10 -1
View File
@@ -63,7 +63,16 @@ export async function GET(request: Request) {
// Super admin can see all
}
if (studentId) where.studentId = studentId;
if (studentId) {
if (role === 'STUDENT' && where.studentId !== studentId) {
return NextResponse.json({ error: 'Forbidden' }, { status: 403 });
}
if (role === 'PARENT') {
const linked = await db.parentStudentLink.findFirst({ where: { parentId: userId, studentId }, select: { id: true } });
if (!linked) return NextResponse.json({ error: 'Forbidden' }, { status: 403 });
}
where.studentId = studentId;
}
if (status) where.status = status;
if (parentApprovalStatus) where.parentApprovalStatus = parentApprovalStatus;