Fixed ordering in ingredient service.
This commit is contained in:
parent
e9b6d81a27
commit
707f88b70b
1 changed files with 6 additions and 4 deletions
|
|
@ -21,11 +21,11 @@ public class IngredientService {
|
|||
}
|
||||
|
||||
public List<Ingredient> findAll() {
|
||||
return ingredientRepository.findAll();
|
||||
return ingredientRepository.findAllByOrderByNameAsc();
|
||||
}
|
||||
|
||||
public List<Ingredient> findAll(int limit) {
|
||||
return ingredientRepository.findAll(PageRequest.of(0, limit)).toList();
|
||||
public List<Ingredient> findAll(int page, int limit) {
|
||||
return ingredientRepository.findAllByOrderByNameAsc(PageRequest.of(page, limit)).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -58,8 +58,10 @@ public class IngredientService {
|
|||
return Optional.of(ingredientRepository.save(ingredient));
|
||||
}
|
||||
|
||||
public void delete(Long id) {
|
||||
public boolean delete(Long id) {
|
||||
if (!ingredientRepository.existsById(id)) return false;
|
||||
ingredientRepository.deleteById(id);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue