From 3cbe28882a2f217d5eeed912a40cec3c7484d5b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A3=BC=EC=B0=AC?= Date: Tue, 31 Mar 2026 12:34:00 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9E=90=EA=B8=B0=20=EC=9E=90=EC=8B=A0?= =?UTF-8?q?=EC=9D=84=20=ED=8C=94=EB=A1=9C=EC=9A=B0=20=ED=95=A0=20=EC=88=98?= =?UTF-8?q?=20=EC=9E=88=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/prothsync/prothsync/service/FollowService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/prothsync/src/main/java/com/prothsync/prothsync/service/FollowService.java b/prothsync/src/main/java/com/prothsync/prothsync/service/FollowService.java index f0e63e3..4b48cdb 100644 --- a/prothsync/src/main/java/com/prothsync/prothsync/service/FollowService.java +++ b/prothsync/src/main/java/com/prothsync/prothsync/service/FollowService.java @@ -7,6 +7,7 @@ import com.prothsync.prothsync.entity.user.Follow; import com.prothsync.prothsync.entity.user.User; import com.prothsync.prothsync.exception.BusinessException; +import com.prothsync.prothsync.exception.FollowErrorCode; import com.prothsync.prothsync.exception.UserErrorCode; import com.prothsync.prothsync.global.PageResponse; import com.prothsync.prothsync.repository.repository.FollowRepository; @@ -33,6 +34,10 @@ public class FollowService { @Transactional public FollowResponseDTO toggleFollow(Long followerId, Long followingId) { + if (followerId.equals(followingId)) { + throw new BusinessException(FollowErrorCode.CANNOT_FOLLOW_SELF); + } + User follower = findUserOrThrow(followerId); User following = findUserOrThrow(followingId);