From 4847a8ac2aeb5e44e42f073e4c8a40aee6eea713 Mon Sep 17 00:00:00 2001 From: haedoang Date: Sun, 5 Nov 2023 23:26:04 +0900 Subject: [PATCH] =?UTF-8?q?=20[feature/contact]=20=EC=A2=8B=EC=95=84?= =?UTF-8?q?=EC=9A=94=20=EC=BF=BC=EB=A6=AC=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/koliving/api/room/application/RoomService.java | 2 +- src/main/java/com/koliving/api/room/infra/LikeRepository.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/koliving/api/room/application/RoomService.java b/src/main/java/com/koliving/api/room/application/RoomService.java index 62f477c5..8bb2dea9 100644 --- a/src/main/java/com/koliving/api/room/application/RoomService.java +++ b/src/main/java/com/koliving/api/room/application/RoomService.java @@ -137,7 +137,7 @@ public void likeRoom(Long roomId, User user) { Room room = getRoom(roomId); final Like like = Like.of(room, user); - likeRepository.findByRoomId(roomId) + likeRepository.findByRoomIdAndUserId(roomId, user.getId()) .ifPresentOrElse( likeRepository::delete, () -> likeRepository.save(like) diff --git a/src/main/java/com/koliving/api/room/infra/LikeRepository.java b/src/main/java/com/koliving/api/room/infra/LikeRepository.java index d8d65405..6f551256 100644 --- a/src/main/java/com/koliving/api/room/infra/LikeRepository.java +++ b/src/main/java/com/koliving/api/room/infra/LikeRepository.java @@ -9,5 +9,5 @@ */ public interface LikeRepository extends JpaRepository { - Optional findByRoomId(Long roomId); + Optional findByRoomIdAndUserId(Long roomId, Long userId); }