Package nl.minetopiasdb.api
Class LoanManager
java.lang.Object
nl.minetopiasdb.api.LoanManager
Management class for loans
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreate a loan in the database and returns aCompletableFuture
containing the loan id.static LoanManager
Get an instance of LoanManagergetLoanById
(int id) Get a CompletableFuture containing a loan if foundgetLoans()
Get a CompletableFuture with a list of all loans.Get a CompletableFuture with a list of all loans for a specific debtor.setPaidOff
(int id, boolean paidOff) Mark a loan as paid off or not.
-
Constructor Details
-
LoanManager
public LoanManager()
-
-
Method Details
-
getInstance
Get an instance of LoanManager- Returns:
- instance of loanmanager
-
create
Create a loan in the database and returns aCompletableFuture
containing the loan id.- Parameters:
uuid
- uuid of the debtoramount
- amount that has been loaned- Returns:
- an instance of
CompletableFuture
containing the loan id.
-
setPaidOff
Mark a loan as paid off or not.- Parameters:
id
- id of the loanpaidOff
- true if loan should now be marked as 'paid off'- Returns:
- an instance of
CompletableFuture
containing the amount of modified rows, you can use this to check if the action was successful.
-
getLoanById
Get a CompletableFuture containing a loan if found- Parameters:
id
- id of loan- Returns:
- an instance of
CompletableFuture
containing a loan if found
-
getLoans
Get a CompletableFuture with a list of all loans.- Returns:
- an instance of
CompletableFuture
containing a list of loans
-
getLoans
Get a CompletableFuture with a list of all loans for a specific debtor.- Parameters:
uuid
- uuid of the debtor- Returns:
- an instance of
CompletableFuture
containing a list of loans
-