feat(backend): add emprunt restitution with automatic anomaly detection
This commit is contained in:
@@ -156,6 +156,14 @@ En terminal interactif (VS Code), `migrate dev` fonctionne normalement (taper `y
|
||||
- Contrôle du poste (existe + même campus, RG05). Routage : `POST /api/emprunts` et `GET /api/mes-emprunts` sur des routeurs séparés.
|
||||
- Vérifié au runtime : 401 sans auth, 400 checklist vide, 404 matériel inconnu, 201 création (matériel -> `EMPRUNTE`, +14j), 409 doublon (réservation atomique).
|
||||
|
||||
### Étape 20 — Block 4 : restitution + anomalie automatique (POST /api/emprunts/:id/restitution)
|
||||
- Comparaison automatique départ/retour (RG17) : un élément présent au départ mais absent/détérioré au retour rend la restitution non conforme (RG20). Appariement par `accessoireId` sinon par `nomElement`.
|
||||
- Restitution atomique : checklist de retour + mise à jour emprunt/matériel + (si non conforme) anomalie `DETECTEE` + notifications.
|
||||
- RG15 (propriétaire), statut restituable, RG18 (conforme -> `CLOTURE` + matériel `DISPONIBLE`), RG19 (non conforme -> `RETOUR_NON_CONFORME` + matériel `DETERIORE`/`NON_CONFORME`).
|
||||
- RG24 : notification à tous les responsables (`RESPONSABLE`) du campus de l'emprunt.
|
||||
- Vérifié au runtime : 404/403/409 ; restitution conforme (CLOTURE + DISPONIBLE) ; non conforme (RETOUR_NON_CONFORME + NON_CONFORME + anomalie + notification à Karim).
|
||||
- **Block 4 (API Étudiant) terminé : 6/6 endpoints.**
|
||||
|
||||
---
|
||||
|
||||
## Dette technique en attente
|
||||
@@ -171,4 +179,4 @@ En terminal interactif (VS Code), `migrate dev` fonctionne normalement (taper `y
|
||||
|
||||
---
|
||||
|
||||
*Dernière mise à jour : 2026-07-06 — Création d'emprunt (POST /api/emprunts) en place (5/6 du Block 4).*
|
||||
*Dernière mise à jour : 2026-07-06 — Restitution + anomalie auto en place. Block 4 (API Étudiant) terminé.*
|
||||
|
||||
Reference in New Issue
Block a user