diff --git a/be/src/main/java/yeonba/be/user/dto/response/UserProfileResponse.java b/be/src/main/java/yeonba/be/user/dto/response/UserProfileResponse.java index 3aea5ad0..b5cb8a3a 100644 --- a/be/src/main/java/yeonba/be/user/dto/response/UserProfileResponse.java +++ b/be/src/main/java/yeonba/be/user/dto/response/UserProfileResponse.java @@ -4,6 +4,8 @@ import java.util.List; import lombok.AllArgsConstructor; import lombok.Getter; +import yeonba.be.user.entity.User; +import yeonba.be.user.entity.UserPreference; @Getter @AllArgsConstructor @@ -68,9 +70,69 @@ public class UserProfileResponse { example = "여우상") private String lookAlikeAnimalName; + @Schema( + type = "number", + description = "선호하는 나이 하한, null일 수 있음", + example = "20") + private Integer preferredAgeLowerBound; + + @Schema( + type = "number", + description = "선호하는 나이 상한, null일 수 있음", + example = "30") + private Integer preferredAgeUpperBound; + + @Schema( + type = "number", + description = "선호하는 키 하한, null일 수 있음", + example = "150") + private Integer preferredHeightLowerBound; + + @Schema( + type = "number", + description = "선호하는 키 상한, null일 수 있음", + example = "180") + private Integer preferredHeightUpperBound; + + @Schema( + type = "string", + description = "선호하는 mbti", + example = "ISTJ") + private String preferredMbti; + + @Schema( + type = "string", + description = "선호하는 체형", + example = "마른체형") + private String preferredBodyType; + @Schema( type = "boolean", description = "이전 화살 전송 여부", example = "false") private boolean isAlreadySentArrow; + + public static UserProfileResponse from( + User user, UserPreference userPreference, boolean isAlreadySentArrow) { + + return new UserProfileResponse( + user.getProfilePhotoUrls(), + user.getGenderString(), + user.getNickname(), + user.getArrow(), + user.getAge(), + user.getHeight(), + user.getArea().getName(), + user.getPhotoSyncRate(), + user.getVocalRange().getClassification(), + user.getAnimal().getName(), + userPreference.getAgeLowerBound(), + userPreference.getAgeUpperBound(), + userPreference.getHeightLowerBound(), + userPreference.getHeightUpperBound(), + userPreference.getMbti(), + userPreference.getBodyType(), + isAlreadySentArrow + ); + } } diff --git a/be/src/main/java/yeonba/be/user/service/UserService.java b/be/src/main/java/yeonba/be/user/service/UserService.java index 991c44b7..11462776 100644 --- a/be/src/main/java/yeonba/be/user/service/UserService.java +++ b/be/src/main/java/yeonba/be/user/service/UserService.java @@ -35,6 +35,7 @@ import yeonba.be.user.repository.user.UserCommand; import yeonba.be.user.repository.user.UserQuery; import yeonba.be.user.repository.userpreference.UserPreferenceCommand; +import yeonba.be.user.repository.userpreference.UserPreferenceQuery; import yeonba.be.user.repository.userrecommendation.UserRecommendationCommand; import yeonba.be.user.repository.userrecommendation.UserRecommendationQuery; import yeonba.be.user.repository.vocalrange.VocalRangeQuery; @@ -54,6 +55,7 @@ public class UserService { private final AreaQuery areaQuery; private final ArrowQuery arrowQuery; private final UserQuery userQuery; + private final UserPreferenceQuery userPreferenceQuery; private final UserRecommendationQuery userRecommendationQuery; private final VocalRangeQuery vocalRangeQuery; @@ -63,22 +65,13 @@ public class UserService { public UserProfileResponse getTargetUserProfile(long userId, long targetUserId) { User user = userQuery.findById(userId); - User targetUser = userQuery.findById(targetUserId); + // 조회하는 사용자 정보, 선호조건, 이전 화살 송신 여부 조회 + User targetUser = userQuery.findById(targetUserId); + UserPreference targetUserPreference = userPreferenceQuery.findByUser(targetUser); boolean isAlreadySentArrow = arrowQuery.isArrowTransactionExist(user, targetUser); - return new UserProfileResponse( - targetUser.getProfilePhotoUrls(), - targetUser.getGenderString(), - targetUser.getNickname(), - targetUser.getArrow(), - targetUser.getAge(), - targetUser.getHeight(), - targetUser.getArea().getName(), - targetUser.getPhotoSyncRate(), - targetUser.getVocalRange().getClassification(), - targetUser.getAnimal().getName(), - isAlreadySentArrow); + return UserProfileResponse.from(targetUser, targetUserPreference, isAlreadySentArrow); } public User saveUser(UserJoinRequest request) {