Skip to content

Commit

Permalink
[MERGE] Merge pull request #228 from Team-WSS/fix/#227
Browse files Browse the repository at this point in the history
[FIX] '알 수 없음' 프로필 조회 불가 처리
  • Loading branch information
Kim-TaeUk authored Nov 14, 2024
2 parents cee6abe + 5364a71 commit bbf16bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/websoso/WSSServer/service/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit bbf16bd

Please sign in to comment.