package com.example.hangry; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; public interface RecipeRepository extends JpaRepository { // Filtert Rezepte nach Kategorie (z. B. vegan, vegetarisch, einfach) Page findByCategoryIgnoreCase(String category, Pageable pageable); // Sucht nach Rezepten, die eine bestimmte Zutat enthalten @Query("SELECT r FROM Recipe r JOIN r.recipeIngredients i WHERE LOWER(i.name) LIKE LOWER(CONCAT('%', :ingredient, '%'))") Page findByIngredient(@Param("ingredient") String ingredient, Pageable pageable); }