From f2f92ffc9108acedf3e6c8b67037b499cce774f9 Mon Sep 17 00:00:00 2001 From: LujaeC Date: Sat, 15 Feb 2025 22:37:27 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[PC-000]=20fix:=20=EC=9A=94=EC=95=BD=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=2050=EC=9E=90=20=EC=B4=88=EA=B3=BC?= =?UTF-8?q?=EC=8B=9C=20=EC=9E=90=EB=A5=B4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../profile/application/ProfileValueTalkSummaryService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/src/main/java/org/yapp/domain/profile/application/ProfileValueTalkSummaryService.java b/api/src/main/java/org/yapp/domain/profile/application/ProfileValueTalkSummaryService.java index 800e6f30..a0f5af7f 100644 --- a/api/src/main/java/org/yapp/domain/profile/application/ProfileValueTalkSummaryService.java +++ b/api/src/main/java/org/yapp/domain/profile/application/ProfileValueTalkSummaryService.java @@ -81,6 +81,9 @@ private List> getSummaryTasks(Long userId) profileValueTalk.getAnswer() + TEXT_CONDITION) .map(summarizedAnswer -> { summarizedAnswer = summarizedAnswer.replaceAll("[\"']", ""); + summarizedAnswer = summarizedAnswer.substring(0, + Math.min(summarizedAnswer.length(), 50)); + sentSummaryResponse(userId, profileValueTalk.getId(), summarizedAnswer); @@ -98,6 +101,9 @@ private List> getSummaryTasks(Profile prof profileValueTalk.getAnswer() + TEXT_CONDITION) .map(summarizedAnswer -> { summarizedAnswer = summarizedAnswer.replaceAll("[\"']", ""); + summarizedAnswer = summarizedAnswer.substring(0, + Math.min(summarizedAnswer.length(), 50)); + return new ProfileValueTalkSummaryResponse(profileValueTalk.getId(), summarizedAnswer); })) From 50ccfb17c3d947a63fb162c386d83e8dca73bcee Mon Sep 17 00:00:00 2001 From: LujaeC Date: Sat, 15 Feb 2025 23:19:04 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[PC-000]=20chore:=20=ED=8F=AC=EB=A7=B7?= =?UTF-8?q?=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../match/presentation/MatchController.java | 152 +++++++++--------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/api/src/main/java/org/yapp/domain/match/presentation/MatchController.java b/api/src/main/java/org/yapp/domain/match/presentation/MatchController.java index 2eb5734e..20fc1b05 100644 --- a/api/src/main/java/org/yapp/domain/match/presentation/MatchController.java +++ b/api/src/main/java/org/yapp/domain/match/presentation/MatchController.java @@ -31,91 +31,91 @@ @RequestMapping("/api/matches") public class MatchController { - private final MatchService matchService; - private final DirectBlockService directBlockService; + private final MatchService matchService; + private final DirectBlockService directBlockService; - @GetMapping("/infos") - @Operation(summary = "매칭 정보 조회", description = "이번 매칭의 정보를 조회합니다.", tags = {"매칭"}) - public ResponseEntity> getMatchInfo() { - MatchInfoResponse matchInfoResponse = matchService.getMatchInfoResponse(); - return ResponseEntity.status(HttpStatus.OK) - .body(CommonResponse.createSuccess(matchInfoResponse)); - } + @GetMapping("/infos") + @Operation(summary = "매칭 정보 조회", description = "이번 매칭의 정보를 조회합니다.", tags = {"매칭"}) + public ResponseEntity> getMatchInfo() { + MatchInfoResponse matchInfoResponse = matchService.getMatchInfoResponse(); + return ResponseEntity.status(HttpStatus.OK) + .body(CommonResponse.createSuccess(matchInfoResponse)); + } - @PatchMapping("/pieces/check") - @Operation(summary = "매칭 조각 확인 체크", description = "이번 매칭의 조각을 확인했음을 서버에 알립니다.", tags = {"매칭"}) - public ResponseEntity> checkMatchPiece() { - matchService.checkPiece(); - return ResponseEntity.status(HttpStatus.OK) - .body(CommonResponse.createSuccessWithNoContent()); - } + @PatchMapping("/pieces/check") + @Operation(summary = "매칭 조각 확인 체크", description = "이번 매칭의 조각을 확인했음을 서버에 알립니다.", tags = {"매칭"}) + public ResponseEntity> checkMatchPiece() { + matchService.checkPiece(); + return ResponseEntity.status(HttpStatus.OK) + .body(CommonResponse.createSuccessWithNoContent()); + } - @GetMapping("/profiles/basic") - @Operation(summary = "매칭 프로필 기본정보 확인", description = "매칭 상대의 프로필 기본정보를 확인합니다.", tags = {"매칭"}) - public ResponseEntity> getBasicMatchProfile() { - MatchProfileBasicResponse matchProfileBasic = matchService.getMatchProfileBasic(); - return ResponseEntity.status(HttpStatus.OK) - .body(CommonResponse.createSuccess(matchProfileBasic)); - } + @GetMapping("/profiles/basic") + @Operation(summary = "매칭 프로필 기본정보 확인", description = "매칭 상대의 프로필 기본정보를 확인합니다.", tags = {"매칭"}) + public ResponseEntity> getBasicMatchProfile() { + MatchProfileBasicResponse matchProfileBasic = matchService.getMatchProfileBasic(); + return ResponseEntity.status(HttpStatus.OK) + .body(CommonResponse.createSuccess(matchProfileBasic)); + } - @GetMapping("/values/talks") - @Operation(summary = "매칭 상대 가치관 톡 확인", description = "매칭 상대의 가치관 톡을 확인합니다.", tags = {"매칭"}) - public ResponseEntity> getMatchTalkValues() { - MatchValueTalkResponse matchValueTalk = matchService.getMatchValueTalk(); - return ResponseEntity.status(HttpStatus.OK) - .body(CommonResponse.createSuccess(matchValueTalk)); - } + @GetMapping("/values/talks") + @Operation(summary = "매칭 상대 가치관 톡 확인", description = "매칭 상대의 가치관 톡을 확인합니다.", tags = {"매칭"}) + public ResponseEntity> getMatchTalkValues() { + MatchValueTalkResponse matchValueTalk = matchService.getMatchValueTalk(); + return ResponseEntity.status(HttpStatus.OK) + .body(CommonResponse.createSuccess(matchValueTalk)); + } - @GetMapping("/values/picks") - @Operation(summary = "매칭 상대 가치관 픽 확인", description = "매칭 상대의 가치관 픽을 확인합니다.", tags = {"매칭"}) - public ResponseEntity> getMatchValuePicks() { - MatchValuePickResponse matchValuePickResponse = matchService.getMatchedUserValuePicks(); - return ResponseEntity.status(HttpStatus.OK) - .body(CommonResponse.createSuccess(matchValuePickResponse)); - } + @GetMapping("/values/picks") + @Operation(summary = "매칭 상대 가치관 픽 확인", description = "매칭 상대의 가치관 픽을 확인합니다.", tags = {"매칭"}) + public ResponseEntity> getMatchValuePicks() { + MatchValuePickResponse matchValuePickResponse = matchService.getMatchedUserValuePicks(); + return ResponseEntity.status(HttpStatus.OK) + .body(CommonResponse.createSuccess(matchValuePickResponse)); + } - @GetMapping("/images") - @Operation(summary = "매칭 상대 프로필 이미지 확인", description = "매칭 상대의 프로필 이미지를 확인합니다.", tags = {"매칭"}) - public ResponseEntity> getMatchedUserImages() { - String matchedUserImageUrl = matchService.getMatchedUserImageUrl(); - ImageUrlResponse imageUrlResponse = new ImageUrlResponse(matchedUserImageUrl); - return ResponseEntity.status(HttpStatus.OK) - .body(CommonResponse.createSuccess(imageUrlResponse)); - } + @GetMapping("/images") + @Operation(summary = "매칭 상대 프로필 이미지 확인", description = "매칭 상대의 프로필 이미지를 확인합니다.", tags = {"매칭"}) + public ResponseEntity> getMatchedUserImages() { + String matchedUserImageUrl = matchService.getMatchedUserImageUrl(); + ImageUrlResponse imageUrlResponse = new ImageUrlResponse(matchedUserImageUrl); + return ResponseEntity.status(HttpStatus.OK) + .body(CommonResponse.createSuccess(imageUrlResponse)); + } - @PostMapping("/accept") - @Operation(summary = "매칭 수락하기", description = "매칭을 수락합니다.", tags = {"매칭"}) - public ResponseEntity> acceptMatch() { - matchService.acceptMatch(); - return ResponseEntity.status(HttpStatus.OK) - .body(CommonResponse.createSuccessWithNoContent()); - } + @PostMapping("/accept") + @Operation(summary = "매칭 수락하기", description = "매칭을 수락합니다.", tags = {"매칭"}) + public ResponseEntity> acceptMatch() { + matchService.acceptMatch(); + return ResponseEntity.status(HttpStatus.OK) + .body(CommonResponse.createSuccessWithNoContent()); + } - @GetMapping("/contacts") - @Operation(summary = "매칭 상대 연락처 조회", description = "매칭 상대의 연락처를 조회합니다", tags = {"매칭"}) - public ResponseEntity> getContacts() { - Map contacts = matchService.getContacts(); - List contactsList = ContactResponses.convert(contacts); - ContactResponses contactResponses = new ContactResponses(contactsList); - return ResponseEntity.status(HttpStatus.OK) - .body(CommonResponse.createSuccess(contactResponses)); - } + @GetMapping("/contacts") + @Operation(summary = "매칭 상대 연락처 조회", description = "매칭 상대의 연락처를 조회합니다", tags = {"매칭"}) + public ResponseEntity> getContacts() { + Map contacts = matchService.getContacts(); + List contactsList = ContactResponses.convert(contacts); + ContactResponses contactResponses = new ContactResponses(contactsList); + return ResponseEntity.status(HttpStatus.OK) + .body(CommonResponse.createSuccess(contactResponses)); + } - @PostMapping("/blocks/users/{userId}") - @Operation(summary = "매칭 상대 차단", description = "매칭 상대를 차단합니다", tags = {"매칭"}) - public ResponseEntity> blockUsers( - @PathVariable(name = "userId") Long userId) { - directBlockService.blockUser(userId); - return ResponseEntity.status(HttpStatus.OK) - .body(CommonResponse.createSuccessWithNoContent()); - } + @PostMapping("/blocks/users/{userId}") + @Operation(summary = "매칭 상대 차단", description = "매칭 상대를 차단합니다", tags = {"매칭"}) + public ResponseEntity> blockUsers( + @PathVariable(name = "userId") Long userId) { + directBlockService.blockUser(userId); + return ResponseEntity.status(HttpStatus.OK) + .body(CommonResponse.createSuccessWithNoContent()); + } - @PutMapping("/refuse") - @Operation(summary = "매칭 거절", description = "매칭을 거절합니다", tags = {"매칭"}) - public ResponseEntity> refuseMatch(@AuthenticationPrincipal Long userId) { - matchService.refuseMatch(userId); - return ResponseEntity.status(HttpStatus.OK) - .body(CommonResponse.createSuccessWithNoContent()); - } + @PutMapping("/refuse") + @Operation(summary = "매칭 거절", description = "매칭을 거절합니다", tags = {"매칭"}) + public ResponseEntity> refuseMatch(@AuthenticationPrincipal Long userId) { + matchService.refuseMatch(userId); + return ResponseEntity.status(HttpStatus.OK) + .body(CommonResponse.createSuccessWithNoContent()); + } } From 5aaefbd99e452b3e060fac3feca882c7ff5f5241 Mon Sep 17 00:00:00 2001 From: LujaeC Date: Sat, 15 Feb 2025 23:19:25 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[PC-000]=20chore:=20=ED=8F=AC=EB=A7=B7?= =?UTF-8?q?=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/yapp/core/domain/match/MatchInfo.java | 102 +++++++++--------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/core/domain/src/main/java/org/yapp/core/domain/match/MatchInfo.java b/core/domain/src/main/java/org/yapp/core/domain/match/MatchInfo.java index 3dab0053..860f043b 100644 --- a/core/domain/src/main/java/org/yapp/core/domain/match/MatchInfo.java +++ b/core/domain/src/main/java/org/yapp/core/domain/match/MatchInfo.java @@ -24,68 +24,68 @@ @NoArgsConstructor public class MatchInfo { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id; + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; - @Column(name = "date") - private LocalDate date; + @Column(name = "date") + private LocalDate date; - @ManyToOne - @JoinColumn(name = "user_1") - @OnDelete(action = OnDeleteAction.CASCADE) - private User user1; + @ManyToOne + @JoinColumn(name = "user_1") + @OnDelete(action = OnDeleteAction.CASCADE) + private User user1; - @Column(name = "user_1_match_status") - @Enumerated(EnumType.STRING) - private UserMatchStatus user1MatchStatus = UserMatchStatus.UNCHECKED; + @Column(name = "user_1_match_status") + @Enumerated(EnumType.STRING) + private UserMatchStatus user1MatchStatus = UserMatchStatus.UNCHECKED; - @ManyToOne - @JoinColumn(name = "user_2") - @OnDelete(action = OnDeleteAction.CASCADE) - private User user2; + @ManyToOne + @JoinColumn(name = "user_2") + @OnDelete(action = OnDeleteAction.CASCADE) + private User user2; - @Column(name = "user_2_match_status") - @Enumerated(EnumType.STRING) - private UserMatchStatus user2MatchStatus = UserMatchStatus.UNCHECKED; + @Column(name = "user_2_match_status") + @Enumerated(EnumType.STRING) + private UserMatchStatus user2MatchStatus = UserMatchStatus.UNCHECKED; - public MatchInfo(LocalDate date, User user1, User user2) { - this.date = date; - this.user1 = user1; - this.user2 = user2; - } + public MatchInfo(LocalDate date, User user1, User user2) { + this.date = date; + this.user1 = user1; + this.user2 = user2; + } - public static MatchInfo createMatchInfo(User user1, User user2) { - return new MatchInfo(LocalDate.now(), user1, user2); - } + public static MatchInfo createMatchInfo(User user1, User user2) { + return new MatchInfo(LocalDate.now(), user1, user2); + } - public void checkPiece(Long userId) { - if (user1.getId().equals(userId)) { - user1MatchStatus = UserMatchStatus.CHECKED; - } else if (user2.getId().equals(userId)) { - user2MatchStatus = UserMatchStatus.CHECKED; - } else { - throw new ApplicationException(MatchErrorCode.INVALID_MATCH_ACCESS); + public void checkPiece(Long userId) { + if (user1.getId().equals(userId)) { + user1MatchStatus = UserMatchStatus.CHECKED; + } else if (user2.getId().equals(userId)) { + user2MatchStatus = UserMatchStatus.CHECKED; + } else { + throw new ApplicationException(MatchErrorCode.INVALID_MATCH_ACCESS); + } } - } - public void acceptPiece(Long userId) { - if (user1.getId().equals(userId)) { - user1MatchStatus = UserMatchStatus.ACCEPTED; - } else if (user2.getId().equals(userId)) { - user2MatchStatus = UserMatchStatus.ACCEPTED; - } else { - throw new ApplicationException(MatchErrorCode.INVALID_MATCH_ACCESS); + public void acceptPiece(Long userId) { + if (user1.getId().equals(userId)) { + user1MatchStatus = UserMatchStatus.ACCEPTED; + } else if (user2.getId().equals(userId)) { + user2MatchStatus = UserMatchStatus.ACCEPTED; + } else { + throw new ApplicationException(MatchErrorCode.INVALID_MATCH_ACCESS); + } } - } - public void refusePiece(Long userId) { - if (user1.getId().equals(userId)) { - user1MatchStatus = UserMatchStatus.REFUSED; - } else if (user2.getId().equals(userId)) { - user2MatchStatus = UserMatchStatus.REFUSED; - } else { - throw new ApplicationException(MatchErrorCode.INVALID_MATCH_ACCESS); + public void refusePiece(Long userId) { + if (user1.getId().equals(userId)) { + user1MatchStatus = UserMatchStatus.REFUSED; + } else if (user2.getId().equals(userId)) { + user2MatchStatus = UserMatchStatus.REFUSED; + } else { + throw new ApplicationException(MatchErrorCode.INVALID_MATCH_ACCESS); + } } - } } From 1e514b6b8a4cc7e038b59dd2fd4a25359f41c815 Mon Sep 17 00:00:00 2001 From: LujaeC Date: Sat, 15 Feb 2025 23:21:29 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[PC-612]=20feat:=20MatchInfoResponse.isBloc?= =?UTF-8?q?ked=20=ED=95=84=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../match/application/MatchService.java | 454 +++++++++--------- .../dto/response/MatchInfoResponse.java | 56 ++- 2 files changed, 261 insertions(+), 249 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 4f361dfd..ae3eeb64 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 @@ -22,6 +22,7 @@ import org.yapp.core.domain.user.User; import org.yapp.core.exception.ApplicationException; import org.yapp.core.exception.error.code.MatchErrorCode; +import org.yapp.domain.block.application.DirectBlockService; import org.yapp.domain.match.dao.MatchInfoRepository; import org.yapp.domain.match.presentation.dto.response.MatchInfoResponse; import org.yapp.domain.match.presentation.dto.response.MatchProfileBasicResponse; @@ -37,242 +38,249 @@ @RequiredArgsConstructor public class MatchService { - 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(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); - } - - @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); - - if (nowDateTime.toLocalTime().isBefore(cutOffTime)) { - return nowDate.minusDays(1); + private final MatchInfoRepository matchInfoRepository; + private final AuthenticationService authenticationService; + private final ProfileValuePickService profileValuePickService; + private final UserService userService; + private final DirectBlockService directBlockService; + + @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)); } - 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 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); - - User matchedUser = getMatchedUser(userId, matchInfo); - User user = userService.getUserById(userId); - List matchedValues = getMatchedValues(user.getProfile().getId(), - matchedUser.getProfile().getId()); - - ProfileBasic profileBasic = matchedUser.getProfile().getProfileBasic(); - - return MatchInfoResponse.builder() - .matchId(matchInfo.getId()) - .matchedUserId(matchedUser.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(); + + @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); + } + + @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); + + 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 MatchInfo getMatchInfo(Long userId) { + return matchInfoRepository.findByUserIdAndDate(userId, getMatchDate()) + .orElseThrow(() -> new ApplicationException(MatchErrorCode.NOTFOUND_MATCH)); } - return matchInfo.getUser1(); - } - private String getMatchStatus(Long userId, MatchInfo matchInfo) { - boolean isUser1 = userId.equals(matchInfo.getUser1().getId()); + @Transactional(readOnly = true) + public MatchInfoResponse getMatchInfoResponse() { + Long userId = authenticationService.getUserId(); + MatchInfo matchInfo = getMatchInfo(userId); + + User matchedUser = getMatchedUser(userId, matchInfo); + User user = userService.getUserById(userId); + + boolean isBlocked = directBlockService.checkBlock(userId, matchedUser.getId()); + + List matchedValues = getMatchedValues(user.getProfile().getId(), + matchedUser.getProfile().getId()); + + ProfileBasic profileBasic = matchedUser.getProfile().getProfileBasic(); + + return MatchInfoResponse.builder() + .matchId(matchInfo.getId()) + .matchedUserId(matchedUser.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) + .isBlocked(isBlocked) + .build(); + } - UserMatchStatus userMatchStatus = - isUser1 ? matchInfo.getUser1MatchStatus() : matchInfo.getUser2MatchStatus(); - UserMatchStatus otherMatchStatus = - isUser1 ? matchInfo.getUser2MatchStatus() : matchInfo.getUser1MatchStatus(); + private User getMatchedUser(Long userId, MatchInfo matchInfo) { + if (userId.equals(matchInfo.getUser1().getId())) { + return matchInfo.getUser2(); + } + return matchInfo.getUser1(); + } - if (userMatchStatus == UserMatchStatus.UNCHECKED) { - return MatchStatus.BEFORE_OPEN.getStatus(); + private String getMatchStatus(Long userId, MatchInfo matchInfo) { + boolean isUser1 = userId.equals(matchInfo.getUser1().getId()); + + UserMatchStatus userMatchStatus = + isUser1 ? matchInfo.getUser1MatchStatus() : matchInfo.getUser2MatchStatus(); + UserMatchStatus otherMatchStatus = + isUser1 ? matchInfo.getUser2MatchStatus() : matchInfo.getUser1MatchStatus(); + + if (userMatchStatus == UserMatchStatus.UNCHECKED) { + return MatchStatus.BEFORE_OPEN.getStatus(); + } + if (userMatchStatus == UserMatchStatus.REFUSED) { + return MatchStatus.REFUSED.getStatus(); + } + if (userMatchStatus == UserMatchStatus.ACCEPTED + && otherMatchStatus == UserMatchStatus.ACCEPTED) { + return MatchStatus.MATCHED.getStatus(); + } + if (userMatchStatus == UserMatchStatus.ACCEPTED) { + return MatchStatus.RESPONDED.getStatus(); + } + if (otherMatchStatus == UserMatchStatus.ACCEPTED) { + return MatchStatus.GREEN_LIGHT.getStatus(); + } + return MatchStatus.WAITING.getStatus(); } - if (userMatchStatus == UserMatchStatus.REFUSED) { - return MatchStatus.REFUSED.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); } - if (userMatchStatus == UserMatchStatus.ACCEPTED - && otherMatchStatus == UserMatchStatus.ACCEPTED) { - return MatchStatus.MATCHED.getStatus(); + + @Transactional(readOnly = true) + public MatchValuePickResponse getMatchedUserValuePicks() { + Long userId = authenticationService.getUserId(); + User user = userService.getUserById(userId); + ProfileBasic profileBasic = user.getProfile().getProfileBasic(); + MatchInfo matchInfo = getMatchInfo(userId); + User matchedUser = getMatchedUser(userId, matchInfo); + List matchValuePickInnerResponses = getMatchValuePickInnerResponses( + user.getProfile().getId(), matchedUser.getProfile().getId()); + + return new MatchValuePickResponse(matchInfo.getId(), profileBasic.getDescription(), + matchedUser.getProfile().getProfileBasic().getNickname(), matchValuePickInnerResponses); } - if (userMatchStatus == UserMatchStatus.ACCEPTED) { - return MatchStatus.RESPONDED.getStatus(); + + 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 answersMap = profileValuePickTo.getValuePick().getAnswers(); + List answers = answersMap.entrySet() + .stream() + .map( + entry -> new ValuePickAnswerResponse(entry.getKey(), (String) entry.getValue())) + .toList(); + 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; } - if (otherMatchStatus == UserMatchStatus.ACCEPTED) { - return MatchStatus.GREEN_LIGHT.getStatus(); + + @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 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)); + + 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; } - 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); - ProfileBasic profileBasic = user.getProfile().getProfileBasic(); - MatchInfo matchInfo = getMatchInfo(userId); - User matchedUser = getMatchedUser(userId, matchInfo); - List matchValuePickInnerResponses = getMatchValuePickInnerResponses( - user.getProfile().getId(), matchedUser.getProfile().getId()); - - return new MatchValuePickResponse(matchInfo.getId(), profileBasic.getDescription(), - matchedUser.getProfile().getProfileBasic().getNickname(), matchValuePickInnerResponses); - } - - 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 answersMap = profileValuePickTo.getValuePick().getAnswers(); - List answers = answersMap.entrySet() - .stream() - .map(entry -> new ValuePickAnswerResponse(entry.getKey(), (String) entry.getValue())) - .toList(); - 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) - ); - } + + @Transactional + public void acceptMatch() { + Long userId = authenticationService.getUserId(); + MatchInfo matchInfo = getMatchInfo(userId); + matchInfo.acceptPiece(userId); } - return talkInnerResponses; - } - - @Transactional(readOnly = true) - public String getMatchedUserImageUrl() { - Long userId = authenticationService.getUserId(); - MatchInfo matchInfo = getMatchInfo(userId); - User matchedUser = getMatchedUser(userId, matchInfo); - - return matchedUser.getProfile().getProfileBasic().getImageUrl(); - } - - 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); - } + @Transactional(readOnly = true) + public Map getContacts() { + Long userId = authenticationService.getUserId(); + MatchInfo matchInfo = getMatchInfo(userId); + if (matchInfo.getUser1MatchStatus() != UserMatchStatus.ACCEPTED + || matchInfo.getUser2MatchStatus() != UserMatchStatus.ACCEPTED) { + throw new ApplicationException(MatchErrorCode.MATCH_NOT_ACCEPTED); + } + User matchedUser = getMatchedUser(userId, matchInfo); + return matchedUser.getProfile().getProfileBasic().getContacts(); } - return matchedValues; - } - - @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.getUser1MatchStatus() != UserMatchStatus.ACCEPTED - || matchInfo.getUser2MatchStatus() != UserMatchStatus.ACCEPTED) { - throw new ApplicationException(MatchErrorCode.MATCH_NOT_ACCEPTED); + + @Transactional + public void refuseMatch(Long userId) { + MatchInfo matchInfo = getMatchInfo(userId); + matchInfo.refusePiece(userId); } - User matchedUser = getMatchedUser(userId, matchInfo); - return matchedUser.getProfile().getProfileBasic().getContacts(); - } - - @Transactional - public void refuseMatch(Long userId) { - MatchInfo matchInfo = getMatchInfo(userId); - matchInfo.refusePiece(userId); - } } 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 00cf2bbd..e32375f8 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 @@ -9,31 +9,35 @@ @NoArgsConstructor public class MatchInfoResponse { - private Long matchId; - private Long matchedUserId; - private String matchStatus; - private String description; - private String nickname; - private String birthYear; - private String location; - private String job; - private Integer matchedValueCount; - private List matchedValueList; + private Long matchId; + private Long matchedUserId; + private String matchStatus; + private String description; + private String nickname; + private String birthYear; + private String location; + private String job; + private Integer matchedValueCount; + private List matchedValueList; + private boolean isBlocked; - @Builder - public MatchInfoResponse(Long matchId, Long matchedUserId, String matchStatus, String description, - String nickname, - String birthYear, - String location, String job, Integer matchedValueCount, List matchedValueList) { - this.matchId = matchId; - this.matchedUserId = matchedUserId; - this.matchStatus = matchStatus; - this.description = description; - this.nickname = nickname; - this.birthYear = birthYear; - this.location = location; - this.job = job; - this.matchedValueCount = matchedValueCount; - this.matchedValueList = matchedValueList; - } + @Builder + public MatchInfoResponse(Long matchId, Long matchedUserId, String matchStatus, + String description, + String nickname, + String birthYear, + String location, String job, Integer matchedValueCount, List matchedValueList, + boolean isBlocked) { + this.matchId = matchId; + this.matchedUserId = matchedUserId; + this.matchStatus = matchStatus; + this.isBlocked = isBlocked; + this.description = description; + this.nickname = nickname; + this.birthYear = birthYear; + this.location = location; + this.job = job; + this.matchedValueCount = matchedValueCount; + this.matchedValueList = matchedValueList; + } } From 41b1ec07a4cb1ca605bc2e594973bb7f39055b21 Mon Sep 17 00:00:00 2001 From: LujaeC Date: Sun, 16 Feb 2025 01:04:34 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[PC-612]=20feat:=20UserMatchStatus.BLOCKED?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/yapp/core/domain/match/MatchInfo.java | 20 +++++++++++++++++++ .../domain/match/enums/UserMatchStatus.java | 9 +++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/core/domain/src/main/java/org/yapp/core/domain/match/MatchInfo.java b/core/domain/src/main/java/org/yapp/core/domain/match/MatchInfo.java index 860f043b..8ab3d640 100644 --- a/core/domain/src/main/java/org/yapp/core/domain/match/MatchInfo.java +++ b/core/domain/src/main/java/org/yapp/core/domain/match/MatchInfo.java @@ -88,4 +88,24 @@ public void refusePiece(Long userId) { throw new ApplicationException(MatchErrorCode.INVALID_MATCH_ACCESS); } } + + public void blockMatch(Long userId) { + if (user1.getId().equals(userId)) { + user1MatchStatus = UserMatchStatus.BLOCKED; + } else if (user2.getId().equals(userId)) { + user2MatchStatus = UserMatchStatus.BLOCKED; + } else { + throw new ApplicationException(MatchErrorCode.INVALID_MATCH_ACCESS); + } + } + + public boolean determineBlocked(Long userId) { + if (user1.getId().equals(userId)) { + return user1MatchStatus == UserMatchStatus.BLOCKED; + } else if (user2.getId().equals(userId)) { + return user2MatchStatus == UserMatchStatus.BLOCKED; + } else { + throw new ApplicationException(MatchErrorCode.INVALID_MATCH_ACCESS); + } + } } diff --git a/core/domain/src/main/java/org/yapp/core/domain/match/enums/UserMatchStatus.java b/core/domain/src/main/java/org/yapp/core/domain/match/enums/UserMatchStatus.java index ccaaa02f..d04d0cd7 100644 --- a/core/domain/src/main/java/org/yapp/core/domain/match/enums/UserMatchStatus.java +++ b/core/domain/src/main/java/org/yapp/core/domain/match/enums/UserMatchStatus.java @@ -1,8 +1,9 @@ package org.yapp.core.domain.match.enums; public enum UserMatchStatus { - UNCHECKED, - CHECKED, - ACCEPTED, - REFUSED + UNCHECKED, + CHECKED, + ACCEPTED, + BLOCKED, + REFUSED } From 3257939019c35fd7af962c243fdce1514f12fd03 Mon Sep 17 00:00:00 2001 From: LujaeC Date: Sun, 16 Feb 2025 09:56:41 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[PC-612]=20fix:=20=EC=83=81=EB=8C=80?= =?UTF-8?q?=EB=B0=A5=20=EC=B0=A8=EB=8B=A8=EC=9D=84=20=EA=B2=80=EC=A6=9D?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?(MatchInfo.UserMatchStatus=20=EC=9D=B4=EC=9A=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../block/application/DirectBlockService.java | 22 +++++++++++++++---- .../match/application/MatchService.java | 5 +---- .../match/presentation/MatchController.java | 9 ++++---- .../dto/request/MatchBlockRequest.java | 5 +++++ .../org/yapp/core/domain/match/MatchInfo.java | 10 +++++++++ 5 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 api/src/main/java/org/yapp/domain/match/presentation/dto/request/MatchBlockRequest.java diff --git a/api/src/main/java/org/yapp/domain/block/application/DirectBlockService.java b/api/src/main/java/org/yapp/domain/block/application/DirectBlockService.java index 4319d135..4eb25a2d 100644 --- a/api/src/main/java/org/yapp/domain/block/application/DirectBlockService.java +++ b/api/src/main/java/org/yapp/domain/block/application/DirectBlockService.java @@ -2,19 +2,33 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; -import org.yapp.core.auth.AuthenticationService; +import org.springframework.transaction.annotation.Transactional; import org.yapp.core.domain.block.DirectBlock; +import org.yapp.core.domain.match.MatchInfo; +import org.yapp.core.exception.ApplicationException; +import org.yapp.core.exception.error.code.MatchErrorCode; import org.yapp.domain.block.dao.DirectBlockRepository; +import org.yapp.domain.match.dao.MatchInfoRepository; @Service @RequiredArgsConstructor public class DirectBlockService { private final DirectBlockRepository directBlockRepository; - private final AuthenticationService authenticationService; + private final MatchInfoRepository matchInfoRepository; - public DirectBlock blockUser(Long blockId) { - Long userId = authenticationService.getUserId(); + @Transactional + public DirectBlock blockMatchedUser(Long userId, Long matchId) { + MatchInfo matchInfo = matchInfoRepository.findById(matchId) + .orElseThrow(() -> new ApplicationException(MatchErrorCode.NOTFOUND_MATCH)); + + matchInfo.blockMatch(userId); + + return blockUser(userId, matchInfo.getPartnerUserId(userId)); + } + + @Transactional + public DirectBlock blockUser(Long userId, Long blockId) { return directBlockRepository.save(new DirectBlock(userId, blockId)); } 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 ae3eeb64..ffedb2c6 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 @@ -22,7 +22,6 @@ import org.yapp.core.domain.user.User; import org.yapp.core.exception.ApplicationException; import org.yapp.core.exception.error.code.MatchErrorCode; -import org.yapp.domain.block.application.DirectBlockService; import org.yapp.domain.match.dao.MatchInfoRepository; import org.yapp.domain.match.presentation.dto.response.MatchInfoResponse; import org.yapp.domain.match.presentation.dto.response.MatchProfileBasicResponse; @@ -42,7 +41,6 @@ public class MatchService { private final AuthenticationService authenticationService; private final ProfileValuePickService profileValuePickService; private final UserService userService; - private final DirectBlockService directBlockService; @Transactional public MatchInfo createMatchInfo(Long user1Id, Long user2Id) { @@ -101,11 +99,10 @@ public MatchInfoResponse getMatchInfoResponse() { User matchedUser = getMatchedUser(userId, matchInfo); User user = userService.getUserById(userId); - boolean isBlocked = directBlockService.checkBlock(userId, matchedUser.getId()); - List matchedValues = getMatchedValues(user.getProfile().getId(), matchedUser.getProfile().getId()); + boolean isBlocked = matchInfo.determineBlocked(userId); ProfileBasic profileBasic = matchedUser.getProfile().getProfileBasic(); return MatchInfoResponse.builder() diff --git a/api/src/main/java/org/yapp/domain/match/presentation/MatchController.java b/api/src/main/java/org/yapp/domain/match/presentation/MatchController.java index 20fc1b05..833aa20f 100644 --- a/api/src/main/java/org/yapp/domain/match/presentation/MatchController.java +++ b/api/src/main/java/org/yapp/domain/match/presentation/MatchController.java @@ -102,13 +102,14 @@ public ResponseEntity> getContacts() { .body(CommonResponse.createSuccess(contactResponses)); } - @PostMapping("/blocks/users/{userId}") + @PostMapping("/{matchId}/blocks") @Operation(summary = "매칭 상대 차단", description = "매칭 상대를 차단합니다", tags = {"매칭"}) public ResponseEntity> blockUsers( - @PathVariable(name = "userId") Long userId) { - directBlockService.blockUser(userId); + @AuthenticationPrincipal Long userId, + @PathVariable Long matchId) { + directBlockService.blockMatchedUser(userId, matchId); return ResponseEntity.status(HttpStatus.OK) - .body(CommonResponse.createSuccessWithNoContent()); + .body(CommonResponse.createSuccessWithNoContent("매칭 상대방을 차단하였습니다.")); } @PutMapping("/refuse") diff --git a/api/src/main/java/org/yapp/domain/match/presentation/dto/request/MatchBlockRequest.java b/api/src/main/java/org/yapp/domain/match/presentation/dto/request/MatchBlockRequest.java new file mode 100644 index 00000000..aa3df960 --- /dev/null +++ b/api/src/main/java/org/yapp/domain/match/presentation/dto/request/MatchBlockRequest.java @@ -0,0 +1,5 @@ +package org.yapp.domain.match.presentation.dto.request; + +public record MatchBlockRequest(Long matchId, Long blockId) { + +} diff --git a/core/domain/src/main/java/org/yapp/core/domain/match/MatchInfo.java b/core/domain/src/main/java/org/yapp/core/domain/match/MatchInfo.java index 8ab3d640..26b47694 100644 --- a/core/domain/src/main/java/org/yapp/core/domain/match/MatchInfo.java +++ b/core/domain/src/main/java/org/yapp/core/domain/match/MatchInfo.java @@ -108,4 +108,14 @@ public boolean determineBlocked(Long userId) { throw new ApplicationException(MatchErrorCode.INVALID_MATCH_ACCESS); } } + + public Long getPartnerUserId(Long userId) { + if (user1.getId().equals(userId)) { + return user2.getId(); + } else if (user2.getId().equals(userId)) { + return user1.getId(); + } else { + throw new ApplicationException(MatchErrorCode.INVALID_MATCH_ACCESS); + } + } }