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; 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); 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;