From 23d1c414dd656fb3976d3d4a643d51910e5ec2f9 Mon Sep 17 00:00:00 2001 From: Jinwoo Lee Date: Mon, 23 Oct 2023 19:01:16 +0900 Subject: [PATCH 1/3] fix: modify anonymous value --- src/main/java/org/swmaestro/repl/gifthub/auth/type/Role.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/swmaestro/repl/gifthub/auth/type/Role.java b/src/main/java/org/swmaestro/repl/gifthub/auth/type/Role.java index 82702878..d1624637 100644 --- a/src/main/java/org/swmaestro/repl/gifthub/auth/type/Role.java +++ b/src/main/java/org/swmaestro/repl/gifthub/auth/type/Role.java @@ -7,7 +7,7 @@ @AllArgsConstructor public enum Role { ADMIN("ROLE_ADMIN,ROLE_USER,ROLE_TEMPORARY"), - USER("ROLE_USER,ROLE_TEMPORARY"), + USER("ROLE_USER,ROLE_ANONYMOUS"), ANONYMOUS("ROLE_ANONYMOUS"); private String value; From 49ad1b5c625f43564c22d76392ec26f5b3ea61b8 Mon Sep 17 00:00:00 2001 From: Jinwoo Lee Date: Mon, 23 Oct 2023 19:01:52 +0900 Subject: [PATCH 2/3] fix: add no-args-constructor annotation --- .../swmaestro/repl/gifthub/auth/dto/UserUpdateRequestDto.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/swmaestro/repl/gifthub/auth/dto/UserUpdateRequestDto.java b/src/main/java/org/swmaestro/repl/gifthub/auth/dto/UserUpdateRequestDto.java index 96c92ff0..bc2bf774 100644 --- a/src/main/java/org/swmaestro/repl/gifthub/auth/dto/UserUpdateRequestDto.java +++ b/src/main/java/org/swmaestro/repl/gifthub/auth/dto/UserUpdateRequestDto.java @@ -3,10 +3,13 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; +import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; +import lombok.NoArgsConstructor; @Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class UserUpdateRequestDto { private String nickname; From e0678031acaeb724c8a915f0dbe183c82d7aeb88 Mon Sep 17 00:00:00 2001 From: Jinwoo Lee Date: Mon, 23 Oct 2023 19:05:23 +0900 Subject: [PATCH 3/3] fix: add nickname-length exception-handling logic --- .../org/swmaestro/repl/gifthub/auth/service/UserService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/swmaestro/repl/gifthub/auth/service/UserService.java b/src/main/java/org/swmaestro/repl/gifthub/auth/service/UserService.java index 896eb2e3..36c7a3db 100644 --- a/src/main/java/org/swmaestro/repl/gifthub/auth/service/UserService.java +++ b/src/main/java/org/swmaestro/repl/gifthub/auth/service/UserService.java @@ -111,6 +111,9 @@ public UserUpdateResponseDto update(String username, Long userId, UserUpdateRequ if (!user.getId().equals(userId)) { throw new BusinessException("수정 권한이 없습니다.", StatusEnum.FORBIDDEN); } + if (userUpdateRequestDto.getNickname().length() < 2 || userUpdateRequestDto.getNickname().length() > 12) { + throw new BusinessException("닉네임은 2자 이상 12자 이하로 입력해주세요.", StatusEnum.BAD_REQUEST); + } if (userUpdateRequestDto.getNickname() != null) { if (isDuplicateNickname(userUpdateRequestDto.getNickname())) { throw new BusinessException("이미 존재하는 닉네임입니다.", StatusEnum.CONFLICT);