From 14c225d043eb49de01c6ca8a9bb477c59e495300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=84=9C=EC=A7=84?= <109809242+PicturePark1101@users.noreply.github.com> Date: Fri, 27 Dec 2024 17:21:17 +0900 Subject: [PATCH] [fix] fix FavoriteImage update logic (#239) --- .../api/favorite/service/FavoriteCommandService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/hankki/hankkiserver/api/favorite/service/FavoriteCommandService.java b/src/main/java/org/hankki/hankkiserver/api/favorite/service/FavoriteCommandService.java index e271c3a9..569f9ef5 100644 --- a/src/main/java/org/hankki/hankkiserver/api/favorite/service/FavoriteCommandService.java +++ b/src/main/java/org/hankki/hankkiserver/api/favorite/service/FavoriteCommandService.java @@ -100,7 +100,9 @@ private void checkTitleExists(final String title, final User user){ } private void copySharedFavoriteStore(final long sharedId, final Favorite myFavorite) { - findStoresById(sharedId).forEach(it -> favoriteStoreUpdater.save(FavoriteStore.create(it, myFavorite))); + List storesInFavoriteStore = findStoresById(sharedId); + storesInFavoriteStore.forEach(it -> favoriteStoreUpdater.save(FavoriteStore.create(it, myFavorite))); + myFavorite.updateImageByFavoriteStoreCount(storesInFavoriteStore.size()); } private List findStoresById(final long id) {