From f0f2d1b499103227bf8193a8d9b99eda0b69b2d1 Mon Sep 17 00:00:00 2001 From: yooonwodyd Date: Fri, 15 Nov 2024 02:55:02 +0900 Subject: [PATCH] refactor:[#84]- refact ArtistType MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ArtistType에 User 추가 --- src/main/java/com/helpmeCookies/user/dto/UserTypeDto.java | 4 +++- .../java/com/helpmeCookies/user/entity/ArtistType.java | 2 +- .../java/com/helpmeCookies/user/service/UserService.java | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/helpmeCookies/user/dto/UserTypeDto.java b/src/main/java/com/helpmeCookies/user/dto/UserTypeDto.java index 627a88c..99ed470 100644 --- a/src/main/java/com/helpmeCookies/user/dto/UserTypeDto.java +++ b/src/main/java/com/helpmeCookies/user/dto/UserTypeDto.java @@ -1,10 +1,12 @@ package com.helpmeCookies.user.dto; +import com.helpmeCookies.user.entity.ArtistType; + import lombok.Builder; @Builder public record UserTypeDto( String role, - String userType + ArtistType userType ) { } diff --git a/src/main/java/com/helpmeCookies/user/entity/ArtistType.java b/src/main/java/com/helpmeCookies/user/entity/ArtistType.java index daefeda..307e5d7 100644 --- a/src/main/java/com/helpmeCookies/user/entity/ArtistType.java +++ b/src/main/java/com/helpmeCookies/user/entity/ArtistType.java @@ -1,7 +1,7 @@ package com.helpmeCookies.user.entity; public enum ArtistType { - BUSINESS("BusinessArtist"), STUDENT("StudentArtist"); + USER("User"), BUSINESS("BusinessArtist"), STUDENT("StudentArtist"); private final String type; diff --git a/src/main/java/com/helpmeCookies/user/service/UserService.java b/src/main/java/com/helpmeCookies/user/service/UserService.java index 5577c2a..2da5c31 100644 --- a/src/main/java/com/helpmeCookies/user/service/UserService.java +++ b/src/main/java/com/helpmeCookies/user/service/UserService.java @@ -14,6 +14,7 @@ import com.helpmeCookies.user.dto.UserTypeDto; import com.helpmeCookies.user.dto.response.UserFollowingRes; import com.helpmeCookies.user.entity.ArtistInfo; +import com.helpmeCookies.user.entity.ArtistType; import com.helpmeCookies.user.entity.Social; import com.helpmeCookies.user.entity.User; import com.helpmeCookies.user.entity.UserInfo; @@ -63,9 +64,9 @@ public UserDto updateUser(UserCommonInfoDto userCommonInfoDto, UserInfoDto userI @Transactional public UserTypeDto getUserType(Long userId) { - String usertype = artistInfoRepository.findByUserId(userId) - .map(artistInfo -> artistInfo.getArtistType().getType()) // 값이 있을 때 처리 - .orElse("User"); // 값이 없을 때 기본값 + ArtistType usertype = artistInfoRepository.findByUserId(userId) + .map(artistInfo -> artistInfo.getArtistType()) // 값이 있을 때 처리 + .orElse(ArtistType.USER); // 값이 없을 때 기본값 return UserTypeDto.builder() .userType(usertype)