feat: cascade deletes, student notes, import popups, module reorganization
- Cascade delete on all entities (student, module, UE, user, role, promotion) - Fix Response body reuse bug (factory functions instead of constants) - Student note viewing via CAS uid (strip non-digit prefix) - Fix middleware page visibility for students in LOCAL mode - Import result popup component (shared across all import pages) - Fix student import to use numEtud from Excel - Bulk student selection with promo change and delete - Move UE/UE-Module API and pages from notes to admin module - Move promotions page from students to admin module - Multi-year maquette import with per-year promo selection - Inline promo creation in maquette import - Static Excel templates (students, notes, maquette) - Fix XLSX export using blob download instead of writeFile - Allow students to read modules list (GET /modules)
This commit is contained in:
@@ -44,13 +44,25 @@ export const handler: Handlers<null, AuthenticatedState> = {
|
||||
idPromo: string;
|
||||
} = await request.json();
|
||||
|
||||
if (!body.nom || !body.prenom || !body.idPromo) {
|
||||
if (!body.nom || !body.prenom) {
|
||||
return new Response(null, { status: 400 });
|
||||
}
|
||||
|
||||
const values: {
|
||||
numEtud?: number;
|
||||
nom: string;
|
||||
prenom: string;
|
||||
idPromo?: string;
|
||||
} = {
|
||||
nom: body.nom,
|
||||
prenom: body.prenom,
|
||||
};
|
||||
if (body.numEtud) values.numEtud = body.numEtud;
|
||||
if (body.idPromo) values.idPromo = body.idPromo;
|
||||
|
||||
const [created] = await db
|
||||
.insert(students)
|
||||
.values({ nom: body.nom, prenom: body.prenom, idPromo: body.idPromo })
|
||||
.values(values)
|
||||
.returning();
|
||||
|
||||
return new Response(JSON.stringify(created), {
|
||||
|
||||
Reference in New Issue
Block a user