refactor code, add interfaces for services
This commit is contained in:
@@ -31,7 +31,7 @@ public class ExpenseMapper {
|
||||
|
||||
public Expense toExpense(ExpenseCreationDTO expenseDTO) {
|
||||
|
||||
return new Expense(expenseCategoryService.getExpenseCategory(expenseDTO.getExpenseCategory()), LocalDate.now(), expenseDTO.getAmount());
|
||||
return new Expense(expenseCategoryService.getCategoryById(expenseDTO.getExpenseCategory()), LocalDate.now(), expenseDTO.getAmount());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,8 +31,7 @@ public class IncomeMapper {
|
||||
}
|
||||
|
||||
public Income toIncome(IncomeCreationDTO incomeDTO) {
|
||||
|
||||
return new Income(incomeCategoryService.getExpenseCategory(incomeDTO.getIncomeCategory()), LocalDate.now(), incomeDTO.getAmount());
|
||||
return new Income(incomeCategoryService.getCategoryById(incomeDTO.getIncomeCategory()), LocalDate.now(), incomeDTO.getAmount());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user