From 49edde093e90203227878c608d3ebb522c4730f1 Mon Sep 17 00:00:00 2001 From: Chanho Lee Date: Wed, 29 Jan 2025 23:50:14 +0900 Subject: [PATCH 1/5] =?UTF-8?q?[PC-443]=20fix:=20=EC=A7=A7=EC=9D=80=20?= =?UTF-8?q?=EC=86=8C=EA=B0=9C=20=EB=B3=80=EC=88=98=EB=AA=85=20=ED=86=B5?= =?UTF-8?q?=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../match/presentation/dto/response/MatchValuePickResponse.java | 2 +- .../match/presentation/dto/response/MatchValueTalkResponse.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValuePickResponse.java b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValuePickResponse.java index 4b195597..3caf21a8 100644 --- a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValuePickResponse.java +++ b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValuePickResponse.java @@ -11,7 +11,7 @@ public class MatchValuePickResponse { private Long matchId; - private String shortIntroduction; + private String shortIntroduce; private String nickname; private List valuePicks; } diff --git a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValueTalkResponse.java b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValueTalkResponse.java index 331bfee9..07edd850 100644 --- a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValueTalkResponse.java +++ b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValueTalkResponse.java @@ -11,7 +11,7 @@ public class MatchValueTalkResponse { private Long matchId; - private String shortIntroduction; + private String shortIntroduce; private String nickname; private List valueTalks; } From 23e10429601db655216b729a26df37aee5e822d0 Mon Sep 17 00:00:00 2001 From: Chanho Lee Date: Fri, 31 Jan 2025 15:19:52 +0900 Subject: [PATCH 2/5] =?UTF-8?q?[PC-443]=20fix:=20=EC=A7=A7=EC=9D=80=20?= =?UTF-8?q?=EC=86=8C=EA=B0=9C=20=EB=B3=80=EC=88=98=EB=AA=85=20description?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/yapp/domain/match/application/MatchService.java | 4 ++-- .../presentation/dto/response/MatchInfoResponse.java | 9 +++++---- .../dto/response/MatchProfileBasicResponse.java | 2 +- .../dto/response/MatchValuePickResponse.java | 2 +- .../dto/response/MatchValueTalkResponse.java | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/api/src/main/java/org/yapp/domain/match/application/MatchService.java b/api/src/main/java/org/yapp/domain/match/application/MatchService.java index a4d84a64..e20c79a8 100644 --- a/api/src/main/java/org/yapp/domain/match/application/MatchService.java +++ b/api/src/main/java/org/yapp/domain/match/application/MatchService.java @@ -95,11 +95,11 @@ public MatchInfoResponse getMatchInfoResponse() { List matchedValues = getMatchedValues(user.getProfile().getId(), matchedUser.getProfile().getId()); - //TODO : 왜 deprecated 된 ProfileBio에만 introduce가 있는지 논의가 필요 MatchInfoResponse response = MatchInfoResponse.builder() .matchId(matchInfo.getId()) .matchStatus(getMatchStatus(userId, matchInfo)) - .shortIntroduce("") // Deprecated 된 BIO 에서 넣어야하는지? + .description(matchedUser.getProfile().getProfileBasic() + .getDescription()) .nickname(matchedUser.getProfile().getProfileBasic().getNickname()) .birthYear( String.valueOf(matchedUser.getProfile().getProfileBasic().getBirthdate().getYear())) diff --git a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchInfoResponse.java b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchInfoResponse.java index 4ae4a59c..3711ad41 100644 --- a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchInfoResponse.java +++ b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchInfoResponse.java @@ -1,7 +1,6 @@ package org.yapp.domain.match.presentation.dto.response; import java.util.List; - import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; @@ -9,9 +8,10 @@ @Getter @NoArgsConstructor public class MatchInfoResponse { + private Long matchId; private String matchStatus; - private String shortIntroduce; + private String description; private String nickname; private String birthYear; private String location; @@ -20,11 +20,12 @@ public class MatchInfoResponse { private List matchedValueList; @Builder - public MatchInfoResponse(Long matchId, String matchStatus, String shortIntroduce, String nickname, String birthYear, + public MatchInfoResponse(Long matchId, String matchStatus, String description, String nickname, + String birthYear, String location, String job, Integer matchedValueCount, List matchedValueList) { this.matchId = matchId; this.matchStatus = matchStatus; - this.shortIntroduce = shortIntroduce; + this.description = description; this.nickname = nickname; this.birthYear = birthYear; this.location = location; diff --git a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchProfileBasicResponse.java b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchProfileBasicResponse.java index 4afec985..7c252fa9 100644 --- a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchProfileBasicResponse.java +++ b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchProfileBasicResponse.java @@ -13,7 +13,7 @@ public class MatchProfileBasicResponse { private Long matchId; - private String shortIntroduce; + private String description; private String nickname; private String age; private String birthYear; diff --git a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValuePickResponse.java b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValuePickResponse.java index 3caf21a8..3b330bc0 100644 --- a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValuePickResponse.java +++ b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValuePickResponse.java @@ -11,7 +11,7 @@ public class MatchValuePickResponse { private Long matchId; - private String shortIntroduce; + private String description; private String nickname; private List valuePicks; } diff --git a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValueTalkResponse.java b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValueTalkResponse.java index 07edd850..e31dc866 100644 --- a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValueTalkResponse.java +++ b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchValueTalkResponse.java @@ -11,7 +11,7 @@ public class MatchValueTalkResponse { private Long matchId; - private String shortIntroduce; + private String description; private String nickname; private List valueTalks; } From 1c596518392c38260e6817b0cab81e1e26584db1 Mon Sep 17 00:00:00 2001 From: Chanho Lee Date: Fri, 31 Jan 2025 23:50:40 +0900 Subject: [PATCH 3/5] =?UTF-8?q?[PC-443]=20fix:=20MatchProfileBasicResponse?= =?UTF-8?q?=20=EB=88=84=EB=9D=BD=EB=90=9C=20=EB=B3=80=EC=88=98=EB=93=A4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/MatchProfileBasicResponse.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchProfileBasicResponse.java b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchProfileBasicResponse.java index 7c252fa9..895afed5 100644 --- a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchProfileBasicResponse.java +++ b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchProfileBasicResponse.java @@ -15,20 +15,27 @@ public class MatchProfileBasicResponse { private Long matchId; private String description; private String nickname; - private String age; + private Integer age; private String birthYear; + private Integer height; + private Integer weight; private String location; private String job; + private String smokingStatus; public static MatchProfileBasicResponse fromProfile(Long matchId, Profile profile) { String nickname = profile.getProfileBasic().getNickname(); LocalDate birthDate = profile.getProfileBasic().getBirthdate(); LocalDate now = LocalDate.now(); - String age = String.valueOf(Period.between(birthDate, now).getYears()); + Integer age = Period.between(birthDate, now).getYears(); String birthYearFormatted = String.valueOf(birthDate.getYear()).substring(2); String location = profile.getProfileBasic().getLocation(); + String description = profile.getProfileBasic().getDescription(); + Integer height = profile.getProfileBasic().getHeight(); + Integer weight = profile.getProfileBasic().getWeight(); String job = profile.getProfileBasic().getJob(); - return new MatchProfileBasicResponse(matchId, "", nickname, birthYearFormatted, age, location, - job); + String smokingStatus = profile.getProfileBasic().getSmokingStatus(); + return new MatchProfileBasicResponse(matchId, description, nickname, age, birthYearFormatted + , height, weight, location, job, smokingStatus); } } From 87c755de060f8584d0e814b128a4d40dc1ae6b3f Mon Sep 17 00:00:00 2001 From: Chanho Lee Date: Sun, 2 Feb 2025 16:58:58 +0900 Subject: [PATCH 4/5] =?UTF-8?q?[PC-443]=20fix:=20MatchProfileBasicResponse?= =?UTF-8?q?Response=20=EC=BD=94=EB=93=9C=20=EB=A6=AC=ED=8C=A9=ED=86=A0?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../response/MatchProfileBasicResponse.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchProfileBasicResponse.java b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchProfileBasicResponse.java index 61a74ff6..04baf0fe 100644 --- a/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchProfileBasicResponse.java +++ b/api/src/main/java/org/yapp/domain/match/presentation/dto/response/MatchProfileBasicResponse.java @@ -6,6 +6,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import org.yapp.core.domain.profile.Profile; +import org.yapp.core.domain.profile.ProfileBasic; @NoArgsConstructor @Getter @@ -24,17 +25,18 @@ public class MatchProfileBasicResponse { private String smokingStatus; public static MatchProfileBasicResponse fromProfile(Long matchId, Profile profile) { - String nickname = profile.getProfileBasic().getNickname(); - LocalDate birthDate = profile.getProfileBasic().getBirthdate(); + ProfileBasic profileBasic = profile.getProfileBasic(); + String nickname = profileBasic.getNickname(); + LocalDate birthDate = profileBasic.getBirthdate(); LocalDate now = LocalDate.now(); Integer age = Period.between(birthDate, now).getYears(); String birthYearFormatted = String.valueOf(birthDate.getYear()).substring(2); - String location = profile.getProfileBasic().getLocation(); - String description = profile.getProfileBasic().getDescription(); - Integer height = profile.getProfileBasic().getHeight(); - Integer weight = profile.getProfileBasic().getWeight(); - String job = profile.getProfileBasic().getJob(); - String smokingStatus = profile.getProfileBasic().getSmokingStatus(); + String location = profileBasic.getLocation(); + String description = profileBasic.getDescription(); + Integer height = profileBasic.getHeight(); + Integer weight = profileBasic.getWeight(); + String job = profileBasic.getJob(); + String smokingStatus = profileBasic.getSmokingStatus(); return new MatchProfileBasicResponse(matchId, description, nickname, age, birthYearFormatted , height, weight, location, job, smokingStatus); } From 5739cde9d7cd4cec0164d543373b50191ee59aff Mon Sep 17 00:00:00 2001 From: Chanho Lee Date: Sun, 2 Feb 2025 17:05:18 +0900 Subject: [PATCH 5/5] =?UTF-8?q?[PC-443]=20fix:=20MatchService=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../match/application/MatchService.java | 393 +++++++++--------- 1 file changed, 197 insertions(+), 196 deletions(-) diff --git a/api/src/main/java/org/yapp/domain/match/application/MatchService.java b/api/src/main/java/org/yapp/domain/match/application/MatchService.java index 47e82f5e..10f641dd 100644 --- a/api/src/main/java/org/yapp/domain/match/application/MatchService.java +++ b/api/src/main/java/org/yapp/domain/match/application/MatchService.java @@ -14,6 +14,7 @@ import org.yapp.core.domain.match.MatchInfo; import org.yapp.core.domain.match.enums.MatchStatus; import org.yapp.core.domain.profile.Profile; +import org.yapp.core.domain.profile.ProfileBasic; import org.yapp.core.domain.profile.ProfileValuePick; import org.yapp.core.domain.profile.ProfileValueTalk; import org.yapp.core.domain.user.User; @@ -33,232 +34,232 @@ @RequiredArgsConstructor public class MatchService { - private final MatchInfoRepository matchInfoRepository; - private final AuthenticationService authenticationService; - private final ProfileValuePickService profileValuePickService; - private final UserService userService; + private final MatchInfoRepository matchInfoRepository; + private final AuthenticationService authenticationService; + private final ProfileValuePickService profileValuePickService; + private final UserService userService; - @Transactional - public MatchInfo createMatchInfo(Long user1Id, Long user2Id) { - User user1 = userService.getUserById(user1Id); - User user2 = userService.getUserById(user2Id); - return matchInfoRepository.save(new MatchInfo(LocalDate.now(), user1, user2)); - } + @Transactional + public MatchInfo createMatchInfo(Long user1Id, Long user2Id) { + User user1 = userService.getUserById(user1Id); + User user2 = userService.getUserById(user2Id); + return matchInfoRepository.save(new MatchInfo(LocalDate.now(), user1, user2)); + } - @Transactional(readOnly = true) - public MatchProfileBasicResponse getMatchProfileBasic() { - Long userId = authenticationService.getUserId(); - MatchInfo matchInfo = getMatchInfo(userId); + @Transactional(readOnly = true) + public MatchProfileBasicResponse getMatchProfileBasic() { + Long userId = authenticationService.getUserId(); + MatchInfo matchInfo = getMatchInfo(userId); - User matchedUser = getMatchedUser(userId, matchInfo); - Profile matchedProfile = matchedUser.getProfile(); - return MatchProfileBasicResponse.fromProfile(matchInfo.getId(), matchedProfile); - } + User matchedUser = getMatchedUser(userId, matchInfo); + Profile matchedProfile = matchedUser.getProfile(); + return MatchProfileBasicResponse.fromProfile(matchInfo.getId(), matchedProfile); + } - @Transactional - public void checkPiece() { - Long userId = authenticationService.getUserId(); - MatchInfo matchInfo = getMatchInfo(userId); - matchInfo.checkPiece(userId); - } + @Transactional + public void checkPiece() { + Long userId = authenticationService.getUserId(); + MatchInfo matchInfo = getMatchInfo(userId); + matchInfo.checkPiece(userId); + } - public LocalDate getMatchDate() { - LocalDateTime nowDateTime = LocalDateTime.now(); - LocalDate nowDate = nowDateTime.toLocalDate(); - LocalTime cutOffTime = LocalTime.of(22, 0); + public LocalDate getMatchDate() { + LocalDateTime nowDateTime = LocalDateTime.now(); + LocalDate nowDate = nowDateTime.toLocalDate(); + LocalTime cutOffTime = LocalTime.of(22, 0); - if (nowDateTime.toLocalTime().isBefore(cutOffTime)) { - return nowDate.minusDays(1); - } - return nowDate; + if (nowDateTime.toLocalTime().isBefore(cutOffTime)) { + return nowDate.minusDays(1); } + return nowDate; + } - @Transactional(readOnly = true) - public boolean wasUsersMatched(Long user1Id, Long user2Id) { - Optional matchInfoByIds = matchInfoRepository.findMatchInfoByIds(user1Id, - user2Id); - return matchInfoByIds.isPresent(); - } + @Transactional(readOnly = true) + public boolean wasUsersMatched(Long user1Id, Long user2Id) { + Optional matchInfoByIds = matchInfoRepository.findMatchInfoByIds(user1Id, + user2Id); + return matchInfoByIds.isPresent(); + } - @Transactional(readOnly = true) - public MatchInfo getMatchInfo(Long userId) { - return matchInfoRepository.findByUserIdAndDate(userId, getMatchDate()) - .orElseThrow(() -> new ApplicationException(MatchErrorCode.NOTFOUND_MATCH)); - } + @Transactional(readOnly = true) + public MatchInfo getMatchInfo(Long userId) { + return matchInfoRepository.findByUserIdAndDate(userId, getMatchDate()) + .orElseThrow(() -> new ApplicationException(MatchErrorCode.NOTFOUND_MATCH)); + } - @Transactional(readOnly = true) - public MatchInfoResponse getMatchInfoResponse() { - Long userId = authenticationService.getUserId(); - MatchInfo matchInfo = getMatchInfo(userId); + @Transactional(readOnly = true) + public MatchInfoResponse getMatchInfoResponse() { + Long userId = authenticationService.getUserId(); + MatchInfo matchInfo = getMatchInfo(userId); - User matchedUser = getMatchedUser(userId, matchInfo); - User user = userService.getUserById(userId); - List matchedValues = getMatchedValues(user.getProfile().getId(), - matchedUser.getProfile().getId()); + User matchedUser = getMatchedUser(userId, matchInfo); + User user = userService.getUserById(userId); + List matchedValues = getMatchedValues(user.getProfile().getId(), + matchedUser.getProfile().getId()); - MatchInfoResponse response = MatchInfoResponse.builder() - .matchId(matchInfo.getId()) - .matchStatus(getMatchStatus(userId, matchInfo)) - .description(matchedUser.getProfile().getProfileBasic() - .getDescription()) - .nickname(matchedUser.getProfile().getProfileBasic().getNickname()) - .birthYear( - String.valueOf(matchedUser.getProfile().getProfileBasic().getBirthdate().getYear())) - .location(matchedUser.getProfile().getProfileBasic().getLocation()) - .job(matchedUser.getProfile().getProfileBasic().getJob()) - .matchedValueCount(matchedValues.size()) - .matchedValueList(matchedValues) - .build(); + ProfileBasic profileBasic = matchedUser.getProfile().getProfileBasic(); - return response; - } + return MatchInfoResponse.builder() + .matchId(matchInfo.getId()) + .matchStatus(getMatchStatus(userId, matchInfo)) + .description(profileBasic + .getDescription()) + .nickname(profileBasic.getNickname()) + .birthYear( + String.valueOf(profileBasic.getBirthdate().getYear()).substring(2)) + .location(profileBasic.getLocation()) + .job(profileBasic.getJob()) + .matchedValueCount(matchedValues.size()) + .matchedValueList(matchedValues) + .build(); + } - private User getMatchedUser(Long userId, MatchInfo matchInfo) { - if (userId.equals(matchInfo.getUser1().getId())) { - return matchInfo.getUser2(); - } - return matchInfo.getUser1(); + private User getMatchedUser(Long userId, MatchInfo matchInfo) { + if (userId.equals(matchInfo.getUser1().getId())) { + return matchInfo.getUser2(); } + return matchInfo.getUser1(); + } - private String getMatchStatus(Long userId, MatchInfo matchInfo) { - if (userId.equals(matchInfo.getUser1().getId())) { - if (!matchInfo.getUser1PieceChecked()) { - return MatchStatus.BEFORE_OPEN.getStatus(); - } - if (matchInfo.getUser1Accepted() && matchInfo.getUser2Accepted()) { - return MatchStatus.MATCHED.getStatus(); - } - if (matchInfo.getUser1Accepted()) { - return MatchStatus.RESPONDED.getStatus(); - } - if (matchInfo.getUser2Accepted()) { - return MatchStatus.GREEN_LIGHT.getStatus(); - } - return MatchStatus.WAITING.getStatus(); - } else { - if (!matchInfo.getUser2PieceChecked()) { - return MatchStatus.BEFORE_OPEN.getStatus(); - } - if (matchInfo.getUser1Accepted() && matchInfo.getUser2Accepted()) { - return MatchStatus.MATCHED.getStatus(); - } - if (matchInfo.getUser2Accepted()) { - return MatchStatus.RESPONDED.getStatus(); - } - if (matchInfo.getUser1Accepted()) { - return MatchStatus.GREEN_LIGHT.getStatus(); - } - return MatchStatus.WAITING.getStatus(); - } + private String getMatchStatus(Long userId, MatchInfo matchInfo) { + if (userId.equals(matchInfo.getUser1().getId())) { + if (!matchInfo.getUser1PieceChecked()) { + return MatchStatus.BEFORE_OPEN.getStatus(); + } + if (matchInfo.getUser1Accepted() && matchInfo.getUser2Accepted()) { + return MatchStatus.MATCHED.getStatus(); + } + if (matchInfo.getUser1Accepted()) { + return MatchStatus.RESPONDED.getStatus(); + } + if (matchInfo.getUser2Accepted()) { + return MatchStatus.GREEN_LIGHT.getStatus(); + } + return MatchStatus.WAITING.getStatus(); + } else { + if (!matchInfo.getUser2PieceChecked()) { + return MatchStatus.BEFORE_OPEN.getStatus(); + } + if (matchInfo.getUser1Accepted() && matchInfo.getUser2Accepted()) { + return MatchStatus.MATCHED.getStatus(); + } + if (matchInfo.getUser2Accepted()) { + return MatchStatus.RESPONDED.getStatus(); + } + if (matchInfo.getUser1Accepted()) { + return MatchStatus.GREEN_LIGHT.getStatus(); + } + return MatchStatus.WAITING.getStatus(); } + } - @Transactional(readOnly = true) - public MatchValueTalkResponse getMatchValueTalk() { - Long userId = authenticationService.getUserId(); - MatchInfo matchInfo = getMatchInfo(userId); - User matchedUser = getMatchedUser(userId, matchInfo); - List profileValueTalks = matchedUser.getProfile().getProfileValueTalks(); - List talkResponses = new ArrayList<>(); - for (ProfileValueTalk profileValueTalk : profileValueTalks) { - String summary = profileValueTalk.getSummary(); - String answer = profileValueTalk.getAnswer(); - String category = profileValueTalk.getValueTalk().getCategory(); - talkResponses.add(new MatchValueTalkInnerResponse(category, summary, answer)); - } - return new MatchValueTalkResponse(matchInfo.getId(), "", - matchedUser.getProfile().getProfileBasic().getNickname(), talkResponses); + @Transactional(readOnly = true) + public MatchValueTalkResponse getMatchValueTalk() { + Long userId = authenticationService.getUserId(); + MatchInfo matchInfo = getMatchInfo(userId); + User matchedUser = getMatchedUser(userId, matchInfo); + List profileValueTalks = matchedUser.getProfile().getProfileValueTalks(); + List talkResponses = new ArrayList<>(); + for (ProfileValueTalk profileValueTalk : profileValueTalks) { + String summary = profileValueTalk.getSummary(); + String answer = profileValueTalk.getAnswer(); + String category = profileValueTalk.getValueTalk().getCategory(); + talkResponses.add(new MatchValueTalkInnerResponse(category, summary, answer)); } + return new MatchValueTalkResponse(matchInfo.getId(), "", + matchedUser.getProfile().getProfileBasic().getNickname(), talkResponses); + } - @Transactional(readOnly = true) - public MatchValuePickResponse getMatchedUserValuePicks() { - Long userId = authenticationService.getUserId(); - User user = userService.getUserById(userId); - MatchInfo matchInfo = getMatchInfo(userId); - User matchedUser = getMatchedUser(userId, matchInfo); - List matchValuePickInnerResponses = getMatchValuePickInnerResponses( - user.getProfile().getId(), matchedUser.getProfile().getId()); + @Transactional(readOnly = true) + public MatchValuePickResponse getMatchedUserValuePicks() { + Long userId = authenticationService.getUserId(); + User user = userService.getUserById(userId); + MatchInfo matchInfo = getMatchInfo(userId); + User matchedUser = getMatchedUser(userId, matchInfo); + List matchValuePickInnerResponses = getMatchValuePickInnerResponses( + user.getProfile().getId(), matchedUser.getProfile().getId()); - return new MatchValuePickResponse(matchInfo.getId(), "", - matchedUser.getProfile().getProfileBasic().getNickname(), matchValuePickInnerResponses); - } + return new MatchValuePickResponse(matchInfo.getId(), "", + matchedUser.getProfile().getProfileBasic().getNickname(), matchValuePickInnerResponses); + } - private List getMatchValuePickInnerResponses(Long fromProfileId, - Long toProfileId) { - List profileValuePicksOfFrom = - profileValuePickService.getAllProfileValuePicksByProfileId(fromProfileId); - List profileValuePicksOfTo = profileValuePickService.getAllProfileValuePicksByProfileId( - toProfileId); + private List getMatchValuePickInnerResponses(Long fromProfileId, + Long toProfileId) { + List profileValuePicksOfFrom = + profileValuePickService.getAllProfileValuePicksByProfileId(fromProfileId); + List profileValuePicksOfTo = profileValuePickService.getAllProfileValuePicksByProfileId( + toProfileId); - List talkInnerResponses = new ArrayList<>(); - int valueListSize = profileValuePicksOfFrom.size(); - for (int i = 0; i < valueListSize; i++) { - ProfileValuePick profileValuePickFrom = profileValuePicksOfFrom.get(i); - ProfileValuePick profileValuePickTo = profileValuePicksOfTo.get(i); - String category = profileValuePickTo.getValuePick().getCategory(); - String question = profileValuePickTo.getValuePick().getQuestion(); - Integer selectedAnswer = profileValuePickTo.getSelectedAnswer(); - Map answers = profileValuePickTo.getValuePick().getAnswers(); - if (profileValuePickTo.getSelectedAnswer() - .equals(profileValuePickFrom.getSelectedAnswer())) { - talkInnerResponses.add( - new MatchValuePickInnerResponse(category, question, true, answers, - selectedAnswer)); - } else { - talkInnerResponses.add( - new MatchValuePickInnerResponse(category, question, false, answers, - selectedAnswer) - ); - } - } - return talkInnerResponses; + List talkInnerResponses = new ArrayList<>(); + int valueListSize = profileValuePicksOfFrom.size(); + for (int i = 0; i < valueListSize; i++) { + ProfileValuePick profileValuePickFrom = profileValuePicksOfFrom.get(i); + ProfileValuePick profileValuePickTo = profileValuePicksOfTo.get(i); + String category = profileValuePickTo.getValuePick().getCategory(); + String question = profileValuePickTo.getValuePick().getQuestion(); + Integer selectedAnswer = profileValuePickTo.getSelectedAnswer(); + Map answers = profileValuePickTo.getValuePick().getAnswers(); + if (profileValuePickTo.getSelectedAnswer() + .equals(profileValuePickFrom.getSelectedAnswer())) { + talkInnerResponses.add( + new MatchValuePickInnerResponse(category, question, true, answers, + selectedAnswer)); + } else { + talkInnerResponses.add( + new MatchValuePickInnerResponse(category, question, false, answers, + selectedAnswer) + ); + } } + return talkInnerResponses; + } - @Transactional(readOnly = true) - public String getMatchedUserImageUrl() { - Long userId = authenticationService.getUserId(); - MatchInfo matchInfo = getMatchInfo(userId); - User matchedUser = getMatchedUser(userId, matchInfo); + @Transactional(readOnly = true) + public String getMatchedUserImageUrl() { + Long userId = authenticationService.getUserId(); + MatchInfo matchInfo = getMatchInfo(userId); + User matchedUser = getMatchedUser(userId, matchInfo); - return matchedUser.getProfile().getProfileBasic().getImageUrl(); - } + return matchedUser.getProfile().getProfileBasic().getImageUrl(); + } - private List getMatchedValues(Long fromProfileId, Long toProfileId) { - List profileValuePicksOfFrom = - profileValuePickService.getAllProfileValuePicksByProfileId(fromProfileId); - List profileValuePicksOfTo = profileValuePickService.getAllProfileValuePicksByProfileId( - toProfileId); + private List getMatchedValues(Long fromProfileId, Long toProfileId) { + List profileValuePicksOfFrom = + profileValuePickService.getAllProfileValuePicksByProfileId(fromProfileId); + List profileValuePicksOfTo = profileValuePickService.getAllProfileValuePicksByProfileId( + toProfileId); - int valueListSize = profileValuePicksOfFrom.size(); - List matchedValues = new ArrayList<>(); - for (int i = 0; i < valueListSize; i++) { - ProfileValuePick profileValuePickOfFrom = profileValuePicksOfFrom.get(i); - ProfileValuePick profileValuePickOfTo = profileValuePicksOfTo.get(i); - if (profileValuePickOfFrom.getSelectedAnswer() - .equals(profileValuePickOfTo.getSelectedAnswer())) { - Integer selectedAnswer = profileValuePickOfTo.getSelectedAnswer(); - Map answers = profileValuePickOfTo.getValuePick().getAnswers(); - String value = (String) answers.get(selectedAnswer); - matchedValues.add(value); - } - } - return matchedValues; + int valueListSize = profileValuePicksOfFrom.size(); + List matchedValues = new ArrayList<>(); + for (int i = 0; i < valueListSize; i++) { + ProfileValuePick profileValuePickOfFrom = profileValuePicksOfFrom.get(i); + ProfileValuePick profileValuePickOfTo = profileValuePicksOfTo.get(i); + if (profileValuePickOfFrom.getSelectedAnswer() + .equals(profileValuePickOfTo.getSelectedAnswer())) { + Integer selectedAnswer = profileValuePickOfTo.getSelectedAnswer(); + Map answers = profileValuePickOfTo.getValuePick().getAnswers(); + String value = (String) answers.get(selectedAnswer); + matchedValues.add(value); + } } + return matchedValues; + } - @Transactional - public void acceptMatch() { - Long userId = authenticationService.getUserId(); - MatchInfo matchInfo = getMatchInfo(userId); - matchInfo.acceptPiece(userId); - } + @Transactional + public void acceptMatch() { + Long userId = authenticationService.getUserId(); + MatchInfo matchInfo = getMatchInfo(userId); + matchInfo.acceptPiece(userId); + } - @Transactional(readOnly = true) - public Map getContacts() { - Long userId = authenticationService.getUserId(); - MatchInfo matchInfo = getMatchInfo(userId); - if (!matchInfo.getUser1Accepted() || !matchInfo.getUser2Accepted()) { - throw new ApplicationException(MatchErrorCode.MATCH_NOT_ACCEPTED); - } - User matchedUser = getMatchedUser(userId, matchInfo); - return matchedUser.getProfile().getProfileBasic().getContacts(); + @Transactional(readOnly = true) + public Map getContacts() { + Long userId = authenticationService.getUserId(); + MatchInfo matchInfo = getMatchInfo(userId); + if (!matchInfo.getUser1Accepted() || !matchInfo.getUser2Accepted()) { + throw new ApplicationException(MatchErrorCode.MATCH_NOT_ACCEPTED); } + User matchedUser = getMatchedUser(userId, matchInfo); + return matchedUser.getProfile().getProfileBasic().getContacts(); + } }