fix: URI ids

now edit functionality is working
This commit is contained in:
filippo-ferrari 2024-05-23 23:26:54 +02:00
parent 8e755bb455
commit 0b47b8c33f
2 changed files with 5 additions and 5 deletions

View file

@ -2,10 +2,10 @@ package com.application.munera.services;
import com.application.munera.data.Category; import com.application.munera.data.Category;
import com.application.munera.repositories.CategoryRepository; import com.application.munera.repositories.CategoryRepository;
import jakarta.persistence.Cache;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -18,7 +18,7 @@ public class CategoryService {
this.categoryRepository = categoryRepository; this.categoryRepository = categoryRepository;
} }
public Optional<Category> get(Long id) { public Optional<Category> findById(Long id) {
return categoryRepository.findById(id); return categoryRepository.findById(id);
} }

View file

@ -40,7 +40,7 @@ import java.util.Optional;
@Uses(Icon.class) @Uses(Icon.class)
public class ExpensesView extends Div implements BeforeEnterObserver { public class ExpensesView extends Div implements BeforeEnterObserver {
private final String EXPENSE_ID = "ExpenseID"; private final String EXPENSE_ID = "expenseID";
private final String EXPENSE_EDIT_ROUTE_TEMPLATE = "/%s/edit"; private final String EXPENSE_EDIT_ROUTE_TEMPLATE = "/%s/edit";
private final Grid<Expense> grid = new Grid<>(Expense.class, false); private final Grid<Expense> grid = new Grid<>(Expense.class, false);
@ -143,7 +143,7 @@ public class ExpensesView extends Div implements BeforeEnterObserver {
populateForm(expenseFromBackend.get()); populateForm(expenseFromBackend.get());
} else { } else {
Notification.show( Notification.show(
String.format("The requested samplePerson was not found, ID = %s", expenseId.get()), 3000, String.format("The requested expense was not found, ID = %s", expenseId.get()), 3000,
Notification.Position.BOTTOM_START); Notification.Position.BOTTOM_START);
// when a row is selected but the data is no longer available, // when a row is selected but the data is no longer available,
// refresh grid // refresh grid