From 9d7d1dba5dd5e7b8d7cc998d7a78806477ba1a8a Mon Sep 17 00:00:00 2001 From: Minjae-An Date: Wed, 22 May 2024 16:39:24 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=EB=8B=A4=EB=A5=B8=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=EC=9E=90=20=ED=94=84=EB=A1=9C=ED=95=84=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EC=9D=91=EB=8B=B5=20DTO=EC=97=90=20=EC=84=A0?= =?UTF-8?q?=ED=98=B8=EC=A1=B0=EA=B1=B4=20=ED=8F=AC=ED=95=A8(#92)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 다른 사용자 프로필 조회시 해당 사용자 선호조건 또한 응답에 포함 --- .../dto/response/UserProfileResponse.java | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) 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..30402a53 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 = "선호하는 나이 하한", + example = "20") + private int preferredAgeLowerBound; + + @Schema( + type = "number", + description = "선호하는 나이 상한", + example = "30") + private int preferredAgeUpperBound; + + @Schema( + type = "number", + description = "선호하는 키 하한", + example = "150") + private int preferredHeightLowerBound; + + @Schema( + type = "number", + description = "선호하는 키 상한", + example = "180") + private int 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 + ); + } } From ea2248396b41e873559aead13fdeac0e3a5fdddd Mon Sep 17 00:00:00 2001 From: Minjae-An Date: Wed, 22 May 2024 16:40:44 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=EB=8B=A4=EB=A5=B8=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=EC=9E=90=20=ED=94=84=EB=A1=9C=ED=95=84=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EB=A1=9C=EC=A7=81,=20=EC=9D=91=EB=8B=B5=EC=97=90?= =?UTF-8?q?=20=EC=84=A0=ED=98=B8=EC=A1=B0=EA=B1=B4=20=ED=8F=AC=ED=95=A8?= =?UTF-8?q?=ED=86=A0=EB=A1=9D=20=EC=88=98=EC=A0=95(#92)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yeonba/be/user/service/UserService.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) 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) { From 280d9749fc9bcbf2773224eb7168a58eadfa93bb Mon Sep 17 00:00:00 2001 From: Minjae-An Date: Mon, 27 May 2024 14:18:52 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=EC=84=A0=ED=98=B8=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EB=82=98=EC=9D=B4/=ED=82=A4=20=EC=83=81=ED=95=9C,?= =?UTF-8?q?=ED=95=98=ED=95=9C=20=ED=95=84=EB=93=9C=20wrapper=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD(#92)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 해당 필드들은 nullable하므로 wrapper 타입으로 변경 --- .../user/dto/response/UserProfileResponse.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 30402a53..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 @@ -72,27 +72,27 @@ public class UserProfileResponse { @Schema( type = "number", - description = "선호하는 나이 하한", + description = "선호하는 나이 하한, null일 수 있음", example = "20") - private int preferredAgeLowerBound; + private Integer preferredAgeLowerBound; @Schema( type = "number", - description = "선호하는 나이 상한", + description = "선호하는 나이 상한, null일 수 있음", example = "30") - private int preferredAgeUpperBound; + private Integer preferredAgeUpperBound; @Schema( type = "number", - description = "선호하는 키 하한", + description = "선호하는 키 하한, null일 수 있음", example = "150") - private int preferredHeightLowerBound; + private Integer preferredHeightLowerBound; @Schema( type = "number", - description = "선호하는 키 상한", + description = "선호하는 키 상한, null일 수 있음", example = "180") - private int preferredHeightUpperBound; + private Integer preferredHeightUpperBound; @Schema( type = "string",