From d68ba20879479d9938a0cb4117a5130a53654ec8 Mon Sep 17 00:00:00 2001 From: Kim-TaeUk Date: Thu, 14 Nov 2024 18:29:56 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[FIX]=20'=EC=95=8C=20=EC=88=98=20=EC=97=86?= =?UTF-8?q?=EC=9D=8C'=EC=9D=98=20=ED=94=84=EB=A1=9C=ED=95=84=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EC=8B=9C=20=EC=98=88=EC=99=B8=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/websoso/WSSServer/service/UserService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/websoso/WSSServer/service/UserService.java b/src/main/java/org/websoso/WSSServer/service/UserService.java index 6968708c9..c9fa54a39 100644 --- a/src/main/java/org/websoso/WSSServer/service/UserService.java +++ b/src/main/java/org/websoso/WSSServer/service/UserService.java @@ -7,6 +7,7 @@ import static org.websoso.WSSServer.exception.error.CustomUserError.ALREADY_SET_NICKNAME; import static org.websoso.WSSServer.exception.error.CustomUserError.ALREADY_SET_PROFILE_STATUS; import static org.websoso.WSSServer.exception.error.CustomUserError.DUPLICATED_NICKNAME; +import static org.websoso.WSSServer.exception.error.CustomUserError.INACCESSIBLE_USER_PROFILE; import static org.websoso.WSSServer.exception.error.CustomUserError.USER_NOT_FOUND; import java.util.List; @@ -133,6 +134,10 @@ public void updateMyProfileInfo(User user, UpdateMyProfileRequest updateMyProfil @Transactional(readOnly = true) public ProfileGetResponse getProfileInfo(User visitor, Long ownerId) { + if (ownerId == -1L) { + throw new CustomUserException(INACCESSIBLE_USER_PROFILE, + "The profile for this user is inaccessible: unknown"); + } User owner = getUserOrException(ownerId); Byte avatarId = owner.getAvatarId(); Avatar avatar = findAvatarByIdOrThrow(avatarId); From 5364a71e4690b516d36879ab938e8b57d5a77e9c Mon Sep 17 00:00:00 2001 From: Kim-TaeUk Date: Thu, 14 Nov 2024 18:30:10 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[FEAT]=20CustomUserError=EC=97=90=20INACCES?= =?UTF-8?q?SIBLE=5FUSER=5FPROFILE=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/websoso/WSSServer/exception/error/CustomUserError.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/websoso/WSSServer/exception/error/CustomUserError.java b/src/main/java/org/websoso/WSSServer/exception/error/CustomUserError.java index c9c8d5845..d24f46dd3 100644 --- a/src/main/java/org/websoso/WSSServer/exception/error/CustomUserError.java +++ b/src/main/java/org/websoso/WSSServer/exception/error/CustomUserError.java @@ -30,7 +30,8 @@ public enum CustomUserError implements ICustomError { ALREADY_SET_NICKNAME("USER-014", "닉네임은 이미 설정된 닉네임과 동일합니다.", BAD_REQUEST), PRIVATE_PROFILE_STATUS("USER-015", "프로필 공개 설정이 비공개이므로 접근할 수 없습니다.", FORBIDDEN), ALREADY_SET_AVATAR("USER-016", "아바타는 이미 설정된 아바타와 동일합니다.", BAD_REQUEST), - ALREADY_SET_INTRO("USER-017", "소개글은 이미 설정된 소개글과 동일합니다.", BAD_REQUEST); + ALREADY_SET_INTRO("USER-017", "소개글은 이미 설정된 소개글과 동일합니다.", BAD_REQUEST), + INACCESSIBLE_USER_PROFILE("USER-018", "해당 사용자는 접근할 수 없는 상태입니다.", FORBIDDEN); private final String code; private final String description;