diff --git a/src/main/java/org/hankki/hankkiserver/api/favorite/service/FavoriteFinder.java b/src/main/java/org/hankki/hankkiserver/api/favorite/service/FavoriteFinder.java index 89f1f115..bba401b5 100644 --- a/src/main/java/org/hankki/hankkiserver/api/favorite/service/FavoriteFinder.java +++ b/src/main/java/org/hankki/hankkiserver/api/favorite/service/FavoriteFinder.java @@ -19,10 +19,10 @@ public Favorite findById(final Long id) { } public List findAllByIds(final List ids) { - return favoriteRepository.findAllByIds(ids); + return favoriteRepository.findByIdIn(ids); } public List findAllByUserId(final Long userId) { - return favoriteRepository.findAllByUserId(userId); + return favoriteRepository.findByUserIdOrderByCreatedAtDesc(userId); } } diff --git a/src/main/java/org/hankki/hankkiserver/domain/favorite/repository/FavoriteRepository.java b/src/main/java/org/hankki/hankkiserver/domain/favorite/repository/FavoriteRepository.java index 4b5b236d..9df367a4 100644 --- a/src/main/java/org/hankki/hankkiserver/domain/favorite/repository/FavoriteRepository.java +++ b/src/main/java/org/hankki/hankkiserver/domain/favorite/repository/FavoriteRepository.java @@ -13,9 +13,7 @@ public interface FavoriteRepository extends JpaRepository { @Query("delete from Favorite f where f in :favorites") void deleteAll(@Param("favorites") List favorites); - @Query("select f from Favorite f where f.id in :favoriteId") - List findAllByIds(@Param("favoriteId") List favoriteId); + List findByIdIn(@Param("favoriteId") List favoriteId); - @Query("select f from Favorite f where f.user.id = :userId order by f.createdAt desc") - List findAllByUserId(@Param("userId") Long userId); -} + List findByUserIdOrderByCreatedAtDesc(Long userId); +} \ No newline at end of file