fix: correct handler bugs exposed by test suite
Check Deno code / Check Deno code (pull_request) Failing after 6s
Tests / Unit tests (pull_request) Successful in 13s
Tests / Integration tests (pull_request) Successful in 1m17s

- ajustements [numEtud]/[idUE]: fix .where() missing and() — PUT/DELETE
  were applying only numEtud condition, modifying all rows for a student
- modules/users/enseignements POST: add try/catch, return 500 on invalid JSON
- modules/[idModule] PUT: add try/catch + type check on nom (string required)
- modules POST: add .trim() check to reject whitespace-only id/nom
- users POST: add .trim() check to reject whitespace-only id/nom/prenom
- ues POST: add .trim() check to reject whitespace-only nom
- notes POST: add type check (typeof number) and bounds check (0 ≤ note ≤ 20)
- ue-modules POST: add coeff >= 0 validation

Update robustness tests to reflect fixed behavior (remove [BUG] labels,
replace assertRejects with status code assertions).
This commit is contained in:
2026-04-26 19:01:53 +02:00
parent 2f4d8db1bf
commit b0930b8da2
9 changed files with 166 additions and 99 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ export const handler: Handlers = {
const body = await request.json();
const { nom } = body;
if (!nom) {
if (!nom || !nom.trim()) {
return new Response("Champ 'nom' manquant", { status: 400 });
}