package com.maternalmall.repository;

import com.maternalmall.domain.Favorite;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Optional;

public interface FavoriteRepository extends JpaRepository<Favorite, Long> {
    List<Favorite> findByCustomerId(Long customerId);
    Optional<Favorite> findByCustomerIdAndProductId(Long customerId, Long productId);

    @Modifying
    @Transactional
    void deleteByCustomerIdAndProductId(Long customerId, Long productId);
}
