From 8ddafb5fb7054bfcdb59159efaa5dd5a352d21f6 Mon Sep 17 00:00:00 2001 From: Lee ChanMi Date: Sat, 28 Oct 2023 23:56:22 +0900 Subject: [PATCH] =?UTF-8?q?#135=20[FIX]=20UserRole=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/domain/user/domain/User.java | 18 ++++++------------ .../domain/user/provider/UserProvider.java | 3 --- .../user/provider/impl/UserProviderImpl.java | 6 ------ 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/server/src/main/java/org/tattour/server/domain/user/domain/User.java b/server/src/main/java/org/tattour/server/domain/user/domain/User.java index 97c9f9ce..eb873c0c 100644 --- a/server/src/main/java/org/tattour/server/domain/user/domain/User.java +++ b/server/src/main/java/org/tattour/server/domain/user/domain/User.java @@ -16,7 +16,6 @@ import lombok.NoArgsConstructor; import lombok.Setter; import org.hibernate.annotations.DynamicInsert; -import org.tattour.server.domain.user.facade.dto.request.UpdateUserProfileReq; import org.tattour.server.infra.socialLogin.client.kakao.domain.SocialPlatform; @Entity @@ -37,10 +36,6 @@ public class User { private String accessToken; private String refreshToken; - @Column(name = "role") - @Enumerated(EnumType.STRING) - private UserRole userRole; - @Enumerated(EnumType.STRING) private SocialPlatform socialPlatform; @@ -56,27 +51,26 @@ public class User { @OneToMany(mappedBy = "user", cascade = CascadeType.ALL) private List productLikeds; - public User(UserRole userRole, Long kakaoId, SocialPlatform socialPlatform, String accessToken, + public User(Long kakaoId, SocialPlatform socialPlatform, String accessToken, String refreshToken) { - this.userRole = userRole; this.kakaoId = kakaoId; this.socialPlatform = socialPlatform; this.accessToken = accessToken; this.refreshToken = refreshToken; } - public User(UserRole userRole, Long kakaoId, SocialPlatform socialPlatform) { - this.userRole = userRole; + public User(Long kakaoId, SocialPlatform socialPlatform) { this.kakaoId = kakaoId; this.socialPlatform = socialPlatform; } - public static User of(Long kakaoId, SocialPlatform socialPlatform, String accessToken, String refreshToken) { - return new User(UserRole.USER, kakaoId, SocialPlatform.KAKAO, accessToken, refreshToken); + public static User of(Long kakaoId, SocialPlatform socialPlatform, String accessToken, + String refreshToken) { + return new User(kakaoId, socialPlatform, accessToken, refreshToken); } public static User of(Long kakaoId, SocialPlatform socialPlatform) { - return new User(UserRole.USER, kakaoId, SocialPlatform.KAKAO); + return new User(kakaoId, socialPlatform); } public void setUserInfo(String name, String phoneNumber) { diff --git a/server/src/main/java/org/tattour/server/domain/user/provider/UserProvider.java b/server/src/main/java/org/tattour/server/domain/user/provider/UserProvider.java index 80760cdc..5e2f6cc5 100644 --- a/server/src/main/java/org/tattour/server/domain/user/provider/UserProvider.java +++ b/server/src/main/java/org/tattour/server/domain/user/provider/UserProvider.java @@ -29,7 +29,4 @@ public interface UserProvider { // 주문 후 남은 포인트 계산 int calculateRestPointAfterOrder(int userPoint, int totalAmount); - - // 유저가 admin인지 검사 - boolean isUserAdmin(User user); } diff --git a/server/src/main/java/org/tattour/server/domain/user/provider/impl/UserProviderImpl.java b/server/src/main/java/org/tattour/server/domain/user/provider/impl/UserProviderImpl.java index 4034c3c8..0f7878e4 100644 --- a/server/src/main/java/org/tattour/server/domain/user/provider/impl/UserProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/user/provider/impl/UserProviderImpl.java @@ -3,7 +3,6 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.tattour.server.domain.user.domain.User; -import org.tattour.server.domain.user.domain.UserRole; import org.tattour.server.domain.user.exception.NotFoundUserException; import org.tattour.server.domain.user.provider.UserProvider; import org.tattour.server.domain.user.provider.vo.HomeUserInfo; @@ -63,9 +62,4 @@ public UserPointAfterOrderInfo readUserPointAfterOrderInfo(User user, int totalA public int calculateRestPointAfterOrder(int userPoint, int totalAmount) { return userPoint - totalAmount; } - - @Override - public boolean isUserAdmin(User user) { - return user.getUserRole().equals(UserRole.ADMIN); - } }