From 63655948649e897dccc8c65c392213a6ebe7ddf3 Mon Sep 17 00:00:00 2001 From: GaBaljaintheroom Date: Sat, 15 Jun 2024 11:52:43 +0900 Subject: [PATCH] =?UTF-8?q?refactor=20:=20UserRoleApiType=20=EB=A7=A4?= =?UTF-8?q?=EA=B2=8C=EB=B3=80=EC=88=98=20=ED=83=80=EC=9E=85=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/example/vo/UserRoleApiType.java | 5 ++--- .../src/main/java/org/example/service/UserService.java | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/api/common-api/src/main/java/org/example/vo/UserRoleApiType.java b/app/api/common-api/src/main/java/org/example/vo/UserRoleApiType.java index 05e24e6e..2c214fbe 100644 --- a/app/api/common-api/src/main/java/org/example/vo/UserRoleApiType.java +++ b/app/api/common-api/src/main/java/org/example/vo/UserRoleApiType.java @@ -1,7 +1,6 @@ package org.example.vo; import lombok.Getter; -import org.example.entity.User; @Getter public enum UserRoleApiType { @@ -15,7 +14,7 @@ public enum UserRoleApiType { this.authority = authority; } - public static UserRoleApiType from(User user) { - return UserRoleApiType.valueOf(user.getUserRole().name()); + public static UserRoleApiType from(UserRole userRole) { + return UserRoleApiType.valueOf(userRole.name()); } } diff --git a/app/api/user-api/src/main/java/org/example/service/UserService.java b/app/api/user-api/src/main/java/org/example/service/UserService.java index fa8663ca..024ded50 100644 --- a/app/api/user-api/src/main/java/org/example/service/UserService.java +++ b/app/api/user-api/src/main/java/org/example/service/UserService.java @@ -23,7 +23,7 @@ public TokenParam login(final LoginServiceRequest loginServiceRequest) { User createdUser = userUseCase.save(loginServiceRequest.toUser()); UserParam userParam = UserParam.builder() .userId(createdUser.getId()) - .role(UserRoleApiType.from(createdUser)) + .role(UserRoleApiType.from(createdUser.getUserRole())) .build(); return jwtGenerator.generate(userParam, new Date());