Update 31 files

This commit is contained in:
[dyad] committed 2026-08-02 15:47:01 +02:00
1 parent 93ad9aa1e7
commit 71b9ca0eb4
31 files changed
+480 -73

No files matched your search

+7
View File
@@ -2,6 +2,7 @@ import { NextResponse } from 'next/server';
import { z } from 'zod';
import { db } from '@/lib/db';
import { getSession } from '@/lib/auth';
import { canAccessStudent } from '@/lib/access-policy';
const noteCategoryEnum = z.enum([
'GENERAL',
@@ -49,6 +50,9 @@ export async function GET(request: Request) {
if (!student) {
return NextResponse.json({ error: 'Student not found' }, { status: 404 });
}
if (!session.user || !(await canAccessStudent(session.user, studentId))) {
return NextResponse.json({ error: 'Forbidden' }, { status: 403 });
}
if (
session.user?.role === 'SCHOOL_ADMIN' &&
@@ -104,6 +108,9 @@ export async function POST(request: Request) {
if (!student) {
return NextResponse.json({ error: 'Student not found' }, { status: 404 });
}
if (!session.user || !(await canAccessStudent(session.user, studentId))) {
return NextResponse.json({ error: 'Forbidden' }, { status: 403 });
}
if (
session.user?.role === 'SCHOOL_ADMIN' &&