Solution: Fine Calculation System
Here's the solution to the fine calculation system challenge.
Solution
Let’s discuss the solution for implementing a fine calculation system.
Update the Book document
First, we add the Boolean available property to the Book class.
Update the BookRepository
Then, we add the findByNameAndAvailableIsNullOrAvailableIsTrue method in the BookRepository interface to search for a book by matching the name and its availability as Null or True.
Create the BookLoanEntry document
Then, we create the BookLoanEntry class in the com.smartdiscover.document package.
Explanation:
-
Lines 10–12: We add annotations like
@Dataand@Documentto transform a class into a document. -
Lines 18 and 19: We add the
ididentifier. -
...