Currently customers and employees can be hard deleted regardless of their loan history,
which would orphan loan records in MongoDB.
Two approaches are being considered — one needs to be chosen:
Option A — Loan history check before delete
- Before deleting a customer, check if they have any loan history
- If loan history exists, block deletion entirely
Option B — Soft delete via active boolean
- Add active boolean field to Customer and Employee (default true)
- Instead of deleting, set active = false
- GET endpoints should only return active = true records by default
- Preserves full loan history
Note
Option B is the preferred approach for a real library system but adds more complexity.
Decision needed before implementation.
Currently customers and employees can be hard deleted regardless of their loan history,
which would orphan loan records in MongoDB.
Two approaches are being considered — one needs to be chosen:
Option A — Loan history check before delete
Option B — Soft delete via active boolean
Note
Option B is the preferred approach for a real library system but adds more complexity.
Decision needed before implementation.