Skip to content

Commit

Permalink
refactor:[#84]- refact ArtistType
Browse files Browse the repository at this point in the history
ArtistType에 User 추가
  • Loading branch information
yooonwodyd committed Nov 14, 2024
1 parent 5f57465 commit f0f2d1b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/main/java/com/helpmeCookies/user/dto/UserTypeDto.java
Original file line number Diff line number Diff line change
@@ -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
) {
}
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/helpmeCookies/user/service/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f0f2d1b

Please sign in to comment.