diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/repository/ProductRepository.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/repository/ProductRepository.java index 08360a6ab573fb7cd79b1a1e3e30677fd9d45cbd..2bacb4c9d0301fe47e9a4cb1a0108ca771e3224c 100644 --- a/src/main/java/ntnu/idatt2016/v233/SmartMat/repository/ProductRepository.java +++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/repository/ProductRepository.java @@ -1,6 +1,5 @@ package ntnu.idatt2016.v233.SmartMat.repository; -import ntnu.idatt2016.v233.SmartMat.model.ShoppingList; import ntnu.idatt2016.v233.SmartMat.model.product.Product; import java.util.List; diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/repository/RecipeRepository.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/repository/RecipeRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..cae4ee3d68f3231fa3071601fce73cf22c718ca0 --- /dev/null +++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/repository/RecipeRepository.java @@ -0,0 +1,52 @@ +package ntnu.idatt2016.v233.SmartMat.repository; + +import java.util.List; +import java.util.Optional; + +import ntnu.idatt2016.v233.SmartMat.model.Recipe; + +/** + * This interface defines the methods for the recipe repository + * + * @author Stian Lyng + * @version 1.0 + */ +public interface RecipeRepository { + + /** + * Saves a recipe to the database + * + * @param recipe the recipe to save + */ + Recipe save (Recipe recipe); + + /** + * Gets a recipe by its ID + * + * @param id the ID of the recipe + * @return an optional containing the recipe if it exists + */ + Optional<Recipe> getById(long id); + + /** + * Gets a recipe by its name + * @param name the name of the recipe + * @return an optional containing the recipe if it exists + */ + Optional<Recipe> getByName(String name); + + /** + * Gets all recipes + * + * @return an optional containing a list of all recipes + */ + Optional<List<Recipe>> getAll(); + + /** + * Deletes a recipe by its ID + * + * @param id the ID of the recipe + */ + void deleteById(int id); + +}