docs: ExpenseFacade
This commit is contained in:
parent
92d1375f24
commit
5a53d41236
1 changed files with 18 additions and 0 deletions
|
@ -1,11 +1,14 @@
|
|||
package com.application.munera.facades;
|
||||
|
||||
import com.application.munera.data.Expense;
|
||||
import com.application.munera.data.Person;
|
||||
import com.application.munera.services.ExpenseService;
|
||||
import com.vaadin.flow.component.notification.Notification;
|
||||
import com.vaadin.flow.component.treegrid.TreeGrid;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class ExpenseFacade {
|
||||
public final ExpenseService expenseService;
|
||||
|
@ -14,6 +17,12 @@ public class ExpenseFacade {
|
|||
this.expenseService = expenseService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an expense as paid
|
||||
* @param expense the expense to set as paid
|
||||
* @param grid the grid reference to update
|
||||
* @param userId the id of the user related to the expense
|
||||
*/
|
||||
public void setExpensePaid(Expense expense, TreeGrid<Object> grid, Long userId) {
|
||||
expense.setIsPaid(true);
|
||||
this.expenseService.update(expense, userId);
|
||||
|
@ -21,4 +30,13 @@ public class ExpenseFacade {
|
|||
grid.select(null);
|
||||
grid.getDataProvider().refreshAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all expenses related to a person, both where the person is a payer and a beneficiary.
|
||||
* @param person the person of the expenses
|
||||
* @return the list of expenses found
|
||||
*/
|
||||
public List<Expense> findExpensesByPerson(final Person person) {
|
||||
return this.expenseService.findExpensesByPerson(person);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue