Interface FridgeItemsRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<FridgeItems,FridgeItemsId>, org.springframework.data.jpa.repository.JpaRepository<FridgeItems,FridgeItemsId>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<FridgeItems>, org.springframework.data.repository.ListCrudRepository<FridgeItems,FridgeItemsId>, org.springframework.data.repository.ListPagingAndSortingRepository<FridgeItems,FridgeItemsId>, org.springframework.data.repository.PagingAndSortingRepository<FridgeItems,FridgeItemsId>, org.springframework.data.repository.query.QueryByExampleExecutor<FridgeItems>, org.springframework.data.repository.Repository<FridgeItems,FridgeItemsId>

@Repository public interface FridgeItemsRepository extends org.springframework.data.jpa.repository.JpaRepository<FridgeItems,FridgeItemsId>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<FridgeItems>
This repository provides CRUD operations for the FridgeItem entity. It extends JpaRepository and JpaSpecificationExecutor interfaces. JpaRepository provides basic CRUD operations while JpaSpecificationExecutor provides search functionality using specifications.
  • Method Details

    • findByItem_ProductName

      Optional<FridgeItems> findByItem_ProductName(String productName)
      Find a fridgeItem with the given name
      Parameters:
      productName - The name of the product
      Returns:
      An Optional containing the FridgeItem, or an empty Optional if not found
    • findByItem_ProductNameAndItem_Store_StoreNameAndFridge_FridgeId

      Optional<FridgeItems> findByItem_ProductNameAndItem_Store_StoreNameAndFridge_FridgeId(String productName, String storeName, Long fridgeId)
      Find a fridgeItem with the given name
      Parameters:
      productName - The name of the product
      storeName - The name of the store the product comes from
      fridgeId - The ID of the fridge
      Returns:
      An Optional containing the FridgeItem, or an empty Optional if not found
    • findByItemAndFridge

      Optional<FridgeItems> findByItemAndFridge(Item item, Fridge fridge)
      Find a FridgeItem by items and fridge
      Parameters:
      item - The items of product
      fridge - the fridge to search in
      Returns:
      An Optional containing the FridgeItem, or an empty Optional if not found
    • findByItem_ItemIdAndFridge_FridgeId

      Optional<FridgeItems> findByItem_ItemIdAndFridge_FridgeId(Long itemId, Long fridgeId)
      Find a FridgeItem by item ID and fridge ID
      Parameters:
      itemId - The items of product, given by a Long object
      fridgeId - The fridge to search in, given by a Long object
      Returns:
      An Optional containing the FridgeItem, or an empty Optional if not found
    • findByFridge

      Optional<List<FridgeItems>> findByFridge(Fridge fridge)
      Find FridgeItems by fridge
      Parameters:
      fridge - the fridge to search in
      Returns:
      An Optional containing the FridgeItem, or an empty Optional if not found
    • findFridgeItemsByPurchaseDateBefore

      Optional<List<FridgeItems>> findFridgeItemsByPurchaseDateBefore(@NonNull @NonNull LocalDateTime purchaseDate)
      Finds fridge items with purchase dates before a given date.
      Parameters:
      purchaseDate - Date of purchase.
      Returns:
      An optional list of items with purchase dates before a given items.
    • findAllByFridge_FridgeId

      Optional<List<FridgeItems>> findAllByFridge_FridgeId(Long fridgeId)
      This method retrieves a list of all the fridge items from a given fridge.
      Parameters:
      fridgeId - The ID of the fridge, given as a Long
      Returns:
      An optional containing the list of fridge items.