Initial commit: EduBox V2 platform

This commit is contained in:
root
2026-06-06 19:55:41 +00:00
commit 0a73a70820
69 changed files with 5634 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
import { NextRequest, NextResponse } from "next/server";
import { prisma } from "@/lib/prisma";
export async function GET(req: NextRequest) {
const { searchParams } = new URL(req.url);
const establishmentId = searchParams.get("establishmentId");
let where: any = {};
if (establishmentId) {
const classes = await prisma.class.findMany({ where: { establishmentId }, select: { id: true } });
const students = await prisma.student.findMany({ where: { classId: { in: classes.map((c) => c.id) } }, select: { id: true } });
where.studentId = { in: students.map((s) => s.id) };
}
const nodes = await prisma.node.findMany({
where,
include: { student: { include: { class: true } }, instances: true },
orderBy: { lastSeen: "desc" },
});
return NextResponse.json(nodes);
}