Currently Book has a simple available boolean which doesn't reflect real world
library scenarios where multiple copies of the same book can exist.
Tasks
- Add totalCopies and availableCopies integer fields to Book
- totalCopies — total copies the library owns, only changes when library acquires or removes copies
- availableCopies — how many copies are currently not on loan
- Keep available boolean but sync it automatically from availableCopies > 0 in the service layer, never set manually
- Update LoanService.createLoan() to decrement availableCopies on loan creation
- Update LoanService return logic to increment availableCopies on book return
- Block loan creation when availableCopies = 0
Note
Issue 3 and Issue 5 depend on this being implemented first.
Currently Book has a simple available boolean which doesn't reflect real world
library scenarios where multiple copies of the same book can exist.
Tasks
Note
Issue 3 and Issue 5 depend on this being implemented first.