-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/#118 매칭을 신청했으나, 매칭되지 않은 사용자의 매칭 상태 변경기능 추가 #119
Merged
mjj111
merged 13 commits into
develop
from
fix/#118_change-matching-status-if-not-matched
Jun 10, 2024
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9a46526
fix(Member) : Member 매칭 상태 변경 조건 추가(이전 회차에 신청 했으나, 매칭 안된 사용자)
suhyun0918 74238e7
fix(MatchingApplication) : 매칭 만료 메서드 추가
suhyun0918 d1d2f52
fix(MatchingResult) : 매칭 만료 메서드 제거
suhyun0918 4e1446f
fix(MatchingRoundRepository) : 불필요한 메서드 삭제
suhyun0918 d7c69bd
style(MatchingRoundRepository) : 공백 제거
suhyun0918 59a84ad
fix(MatchingApplicationRepository) : 매칭 신청 정보 조회시, Long 타입으로 조회할 수 있도…
suhyun0918 96af369
fix(MatchingProcessService) : 매칭을 신청했으나, 매칭 되지 않은 회원도 매칭 상태를 변경할 수 있도…
suhyun0918 aab32fd
fix(Member) : 매칭 상태변경 메서드에 else 키워드 추가
suhyun0918 9e58efe
style(MatchingError) : 불필요한 공백 제거
suhyun0918 63cfd05
fix(MatchingProcessService) : 알림을 보낼 대상이 없으면 에러가 발생하므로, hasMatchedPar…
suhyun0918 d7be6fd
feat(MatchingProcessService) : 매칭되지 않은 사용자의 매칭 상태를 변경하는 기능 추가
suhyun0918 25619e5
feat(Participant) : 매칭 상태 만료 메서드 추가
suhyun0918 f9f4d12
test(MatchingApplicationServiceTest) : 매칭을 신청했으나, 매칭되지 않은 사용자의 매칭 상태가…
suhyun0918 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,7 +82,6 @@ public List<MatchingResultResponse> findMatchingResult(final LoginMember loginMe | |
.toList(); | ||
} | ||
|
||
|
||
private ChatParticipant getChatParticipant(final LoginMember loginMember, final MatchingResult result) { | ||
return chatParticipantRepository.findByMemberIdAndMatchedMemberId(loginMember.memberId(), result.getMatchedMemberId()) | ||
.orElseThrow(() -> new RestApiException(MatchingError.NOT_FOUND_MATCHING_APPLICATION_INFO)); } | ||
|
@@ -92,12 +91,12 @@ private MatchingApplication findMatchedMemberApplicationByRoundAndMemberId(Match | |
.orElseThrow(() -> new RestApiException(MatchingError.NOT_FOUND_MATCHING_APPLICATION_INFO)); | ||
} | ||
|
||
|
||
@Scheduled(cron = "${matching.round.end}") | ||
@Transactional | ||
public void expireMatching() { | ||
List<MatchingResult> previousMatchingResults = getPreviousMatchingResults(); | ||
previousMatchingResults.forEach(MatchingResult::expireMatch); | ||
List<MatchingApplication> previousMatchingApplications = getPreviousMatchingApplications(); | ||
previousMatchingApplications.forEach(MatchingApplication::expireMatch); | ||
eventPublisher.expireChatRoom(previousMatchingResults); | ||
} | ||
|
||
|
@@ -106,8 +105,17 @@ private void saveMatchingResult(final MatchingRound matchingRound, final List<Pa | |
.flatMap(participant -> participant.partners().stream() | ||
.map(partner -> MatchingResult.from(matchingRound, participant, partner))) | ||
.forEach(this::matchBetween); | ||
eventPublisher.createChatRoom(participants); | ||
eventPublisher.sendNotification(participants); | ||
participants.stream() | ||
.filter(participant -> !participant.hasPartner()) | ||
.forEach(Participant::expireMatch); | ||
if (hasMatchedParticipants(participants)) { | ||
eventPublisher.createChatRoom(participants); | ||
eventPublisher.sendNotification(participants); | ||
} | ||
} | ||
|
||
private boolean hasMatchedParticipants(List<Participant> participants) { | ||
return !participants.stream().filter(Participant::hasPartner).toList().isEmpty(); | ||
} | ||
Comment on lines
+111
to
119
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fcm 알림을 보낼때, 보낼 대상이 한명도 없으면 에러가 터져서 추가한 메서드 입니다! |
||
|
||
private void checkHasApplied(final List<MatchingResult> matchingResults) { | ||
|
@@ -126,7 +134,7 @@ private List<MatchingResult> getMatchingResults(final MatchingRound matchingRoun | |
} | ||
|
||
private List<MatchingApplication> getMatchingApplications(final MatchingRound matchingRound) { | ||
return matchingApplicationRepository.findAllByMatchingRound(matchingRound); | ||
return matchingApplicationRepository.findAllByRound(matchingRound.getRound()); | ||
} | ||
|
||
private List<MatchingResult> getPreviousMatchingResults() { | ||
|
@@ -135,6 +143,12 @@ private List<MatchingResult> getPreviousMatchingResults() { | |
return matchingResultRepository.findAllByRound(previousRound); | ||
} | ||
|
||
private List<MatchingApplication> getPreviousMatchingApplications() { | ||
MatchingRound currentRound = getCurrentRound(); | ||
Long previousRound = currentRound.getPreviousRound(); | ||
return matchingApplicationRepository.findAllByRound(previousRound); | ||
} | ||
|
||
private List<Block> getBlockListByMatchingApplications(final List<MatchingApplication> matchingApplications) { | ||
List<Block> blockHistory = matchingApplications.stream() | ||
.map(MatchingApplication::getMember) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이번에 추가된 부분입니다~
매칭 되지 않은 사용자들의 매칭 신청을 만료 시키는 로직이에용