comment and access fixes for RecipeService
This commit is contained in:
parent
299385c7b1
commit
d56b07f2aa
1 changed files with 4 additions and 4 deletions
|
|
@ -24,22 +24,22 @@ public class RecipeService {
|
||||||
this.recipeIngredientRepository = recipeIngredientRepository;
|
this.recipeIngredientRepository = recipeIngredientRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<Recipe> findById(Long id) {
|
public Optional<Recipe> findById(Long id) {
|
||||||
return recipeRepository.findById(id);
|
return recipeRepository.findById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Recipe> findAll() {
|
public List<Recipe> findAll() {
|
||||||
return recipeRepository.findAll();
|
return recipeRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Recipe> findAll(int limit) {
|
public List<Recipe> findAll(int limit) {
|
||||||
return recipeRepository.findAll(PageRequest.of(0, limit)).toList();
|
return recipeRepository.findAll(PageRequest.of(0, limit)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new recipe. Returns empty if the recipe with the same name already exists.
|
* Creates a new recipe. Returns empty if the recipe with the same name already exists.
|
||||||
* @param recipe Recipe to be saved in the db.
|
* @param recipe Recipe to be saved in the db.
|
||||||
* @return The created recipe (the recipe arg with a new assigned id).
|
* @return The created recipe (the recipe arg with a new assigned id) or empty if it already exists in db.
|
||||||
*/
|
*/
|
||||||
public Optional<Recipe> create(Recipe recipe) {
|
public Optional<Recipe> create(Recipe recipe) {
|
||||||
if (recipeRepository.existsByName(recipe.getName())) {
|
if (recipeRepository.existsByName(recipe.getName())) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue