Class MongoDebtRepository
java.lang.Object
com.truebubo.maniflow.debt.MongoDebtRepository
- All Implemented Interfaces:
DebtRepository
Repository used for dealing with storage and retrieval of debts using MongoDB
-
Constructor Summary
ConstructorsConstructorDescriptionMongoDebtRepository
(com.mongodb.client.MongoClient mongoClient) Creates mongo repository -
Method Summary
-
Constructor Details
-
MongoDebtRepository
public MongoDebtRepository(@NonNull com.mongodb.client.MongoClient mongoClient) Creates mongo repository- Parameters:
mongoClient
- Mongo client to be used
-
-
Method Details
-
saveDebt
Description copied from interface:DebtRepository
Saves the debt to storage- Specified by:
saveDebt
in interfaceDebtRepository
- Parameters:
debt
- Debt saved- Returns:
- debt saved
-
getDebt
Description copied from interface:DebtRepository
Finds the debt with given id- Specified by:
getDebt
in interfaceDebtRepository
- Parameters:
id
- ID as shown in showDebts- Returns:
- Debt if found otherwise empty
-
getDebts
Description copied from interface:DebtRepository
Finds all the current debt- Specified by:
getDebts
in interfaceDebtRepository
- Returns:
- List of all the debts saved
-
changeDebt
Description copied from interface:DebtRepository
Changes the debt with given id- Specified by:
changeDebt
in interfaceDebtRepository
- Parameters:
id
- ID identifying the debt. It is the left value displayed when calling showExpensesnewAmount
- Will update the value to this value. If set to zero. The debt will be erased- Returns:
- Value of new debt or empty if not exist
-