Skip to content

Commit

Permalink
#135 [FIX] UserRole 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
05AM committed Oct 28, 2023
1 parent 66542fa commit 8ddafb5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;

Expand All @@ -56,27 +51,26 @@ public class User {
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL)
private List<ProductLiked> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,4 @@ public interface UserProvider {

// 주문 후 남은 포인트 계산
int calculateRestPointAfterOrder(int userPoint, int totalAmount);

// 유저가 admin인지 검사
boolean isUserAdmin(User user);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

0 comments on commit 8ddafb5

Please sign in to comment.