The Unpopular Decision

This commit is contained in:
etc404
2026-04-16 17:49:41 -06:00
parent cefc69bd33
commit 6663539011
82 changed files with 5772 additions and 0 deletions
@@ -0,0 +1,11 @@
package com.example.demo.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.demo.entity.Favorite;
import com.example.demo.entity.FavoriteId;
import java.util.List;
public interface FavoriteRepo extends JpaRepository<Favorite, FavoriteId> {
}
@@ -0,0 +1,10 @@
package com.example.demo.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.demo.entity.Image;
import java.util.List;
public interface ImageRepo extends JpaRepository<Image, Integer> {
}
@@ -0,0 +1,10 @@
package com.example.demo.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.demo.entity.Ingredient;
public interface IngredientRepo extends JpaRepository<Ingredient, Integer> {
Optional<Ingredient> findByNameIgnoreCase(String name);
}
@@ -0,0 +1,14 @@
package com.example.demo.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.demo.entity.Recipe;
import com.example.demo.entity.RecipeIngredient;
public interface RecipeIngredientRepo extends JpaRepository<RecipeIngredient, Integer> {
// Custom query: find all ingredients for a recipe
List<RecipeIngredient> findByRecipeId(Integer recipeId);
void deleteByRecipe(Recipe recipe);
}
@@ -0,0 +1,18 @@
package com.example.demo.repository;
import java.time.LocalDateTime;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.demo.entity.Recipe;
public interface RecipeRepo extends JpaRepository<Recipe, Integer> {
List<Recipe> findByTitleContainingIgnoreCase(String name);
List<Recipe> findByTitleContainingIgnoreCaseAndTags_NameIn(String title, List<String> tags);
long countByUserIdAndCreatedAtAfter(Integer userId, LocalDateTime after);
List<Recipe> findByUserId(Integer userId);
}
@@ -0,0 +1,11 @@
package com.example.demo.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.demo.entity.RecipeTag;
import com.example.demo.entity.RecipeTagId;
import java.util.List;
public interface RecipeTagRepo extends JpaRepository<RecipeTag, RecipeTagId> {
}
@@ -0,0 +1,11 @@
package com.example.demo.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.demo.entity.Step;
import java.util.List;
public interface StepRepo extends JpaRepository<Step, Integer> {
}
@@ -0,0 +1,12 @@
package com.example.demo.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.demo.entity.Ingredient;
import com.example.demo.entity.Tag;
import java.util.Optional;
public interface TagRepo extends JpaRepository<Tag, Integer> {
Optional<Tag> findByName(String name);
}
@@ -0,0 +1,16 @@
package com.example.demo.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.demo.entity.User;
import java.util.List;
import java.util.Optional;
public interface UserRepo extends JpaRepository<User, Integer> {
Optional<User> findByUsername(String username);
List<User> findByUsernameContainingIgnoreCase(String name);
}