-
Notifications
You must be signed in to change notification settings - Fork 1
[Feature] 미팅 전체 취소 api 구현 및 미팅 정책 위반 로직 수정 #78
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
Open
Sehi55
wants to merge
19
commits into
develop
Choose a base branch
from
feat/meeting-cancellation
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
0a1fc36
Merge pull request #72 from mannabom/develop
Sehi55 cef7921
Merge pull request #74 from mannabom/develop
Sehi55 4662e63
feat: 미팅 취소 도메인 구현
Sehi55 602f4fe
feat: 미팅 전체 취소 투표 기능 구현
Sehi55 4c00230
refactor: 안쓰는 import 정리
Sehi55 9ca052e
fix: 취소 투표 중 미팅방 참여자 변경 차단
Sehi55 481064e
fix: 매칭방 퇴장 시 빠른 입장 상태로 전환
Sehi55 0b4b1b8
feat: 빠른 입장 사용자를 매칭 채팅방에 연결
Sehi55 db01a8c
feat: 매칭 성사 후 동성 채팅방 비활성화
Sehi55 78ce659
feat: 코드 빠른 입장 사용자를 매칭 채팅방에 연결
Sehi55 f7a7057
fix: 매칭 상태에서 남녀 채팅방 ID 반환
Sehi55 7295166
feat: 전체 미팅 취소를 매칭 단위로 전환
Sehi55 3ac29d9
fix: 비활성 채팅방 웹소켓 구독 차단
Sehi55 9e975f1
fix: 미팅 취소 상태 제약 조건 동기화
Sehi55 8413de5
fix: 매칭 채팅방 재입장 허용
Sehi55 d276216
fix: 미팅 취소 만료 처리를 건별 트랜잭션으로 분리
Sehi55 55f187b
fix: 만료 예외 오류 수정
Sehi55 6c635d3
test: 미팅 취소 승인 테스트 mock 보강
Sehi55 21bd0fa
fix: 활성 채팅 멤버 중복 데이터 정리
Sehi55 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 hidden or 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 hidden or 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
14 changes: 14 additions & 0 deletions
14
...nnabom_server/manabom/application/meeting/dto/request/MeetingCancellationVoteRequest.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package mannabom_server.manabom.application.meeting.dto.request; | ||
|
|
||
| import jakarta.validation.constraints.NotNull; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import mannabom_server.manabom.domain.meeting.enums.CancellationVoteDecision; | ||
|
|
||
| @Getter | ||
| @NoArgsConstructor | ||
| public class MeetingCancellationVoteRequest { | ||
|
|
||
| @NotNull(message = "동의 또는 비동의를 선택해야 합니다.") | ||
| private CancellationVoteDecision decision; | ||
| } |
55 changes: 55 additions & 0 deletions
55
...mannabom_server/manabom/application/meeting/dto/response/MeetingCancellationResponse.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| package mannabom_server.manabom.application.meeting.dto.response; | ||
|
|
||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import mannabom_server.manabom.domain.meeting.entity.MeetingCancellationRequest; | ||
| import mannabom_server.manabom.domain.meeting.entity.MeetingCancellationVote; | ||
| import mannabom_server.manabom.domain.meeting.enums.CancellationVoteDecision; | ||
| import mannabom_server.manabom.domain.meeting.enums.MeetingCancellationStatus; | ||
|
|
||
| import java.time.Instant; | ||
| import java.util.List; | ||
|
|
||
| @Getter | ||
| @Builder | ||
| public class MeetingCancellationResponse { | ||
| private Long requestId; | ||
| private Long matchId; | ||
| private Long initiatorUserId; | ||
| private MeetingCancellationStatus status; | ||
| private Instant requestedAt; | ||
| private Instant expiresAt; | ||
| private Instant completedAt; | ||
| private int totalMemberCount; | ||
| private int agreedMemberCount; | ||
| private int pendingMemberCount; | ||
| private List<MeetingCancellationVoteResponse> votes; | ||
|
|
||
| public static MeetingCancellationResponse of( | ||
| MeetingCancellationRequest request, | ||
| List<MeetingCancellationVote> votes | ||
| ) { | ||
| int agreed = (int) votes.stream() | ||
| .filter(vote -> vote.getDecision() == CancellationVoteDecision.AGREE) | ||
| .count(); | ||
| int pending = (int) votes.stream() | ||
| .filter(vote -> vote.getDecision() == CancellationVoteDecision.PENDING) | ||
| .count(); | ||
|
|
||
| return MeetingCancellationResponse.builder() | ||
| .requestId(request.getId()) | ||
| .matchId(request.getMeetingMatch().getId()) | ||
| .initiatorUserId(request.getInitiator().getUserId()) | ||
| .status(request.getStatus()) | ||
| .requestedAt(request.getRequestedAt()) | ||
| .expiresAt(request.getExpiresAt()) | ||
| .completedAt(request.getCompletedAt()) | ||
| .totalMemberCount(votes.size()) | ||
| .agreedMemberCount(agreed) | ||
| .pendingMemberCount(pending) | ||
| .votes(votes.stream() | ||
| .map(MeetingCancellationVoteResponse::from) | ||
| .toList()) | ||
| .build(); | ||
| } | ||
| } |
24 changes: 24 additions & 0 deletions
24
...abom_server/manabom/application/meeting/dto/response/MeetingCancellationVoteResponse.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package mannabom_server.manabom.application.meeting.dto.response; | ||
|
|
||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import mannabom_server.manabom.domain.meeting.entity.MeetingCancellationVote; | ||
| import mannabom_server.manabom.domain.meeting.enums.CancellationVoteDecision; | ||
|
|
||
| import java.time.Instant; | ||
|
|
||
| @Getter | ||
| @Builder | ||
| public class MeetingCancellationVoteResponse { | ||
| private Long userId; | ||
| private CancellationVoteDecision decision; | ||
| private Instant decidedAt; | ||
|
|
||
| public static MeetingCancellationVoteResponse from(MeetingCancellationVote vote) { | ||
| return MeetingCancellationVoteResponse.builder() | ||
| .userId(vote.getUser().getUserId()) | ||
| .decision(vote.getDecision()) | ||
| .decidedAt(vote.getDecidedAt()) | ||
| .build(); | ||
| } | ||
| } |
23 changes: 23 additions & 0 deletions
23
...a/mannabom_server/manabom/application/meeting/scheduler/MeetingCancellationScheduler.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| package mannabom_server.manabom.application.meeting.scheduler; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import mannabom_server.manabom.application.meeting.service.MeetingCancellationService; | ||
| import org.springframework.scheduling.annotation.Scheduled; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| @Component | ||
| @Slf4j | ||
| @RequiredArgsConstructor | ||
| public class MeetingCancellationScheduler { | ||
|
|
||
| private final MeetingCancellationService meetingCancellationService; | ||
|
|
||
| @Scheduled(fixedDelayString = "${meeting.cancellation.expiration-check-delay:60000}") | ||
| public void expireCancellationRequests() { | ||
| int expiredCount = meetingCancellationService.expirePendingRequests(); | ||
| if (expiredCount > 0) { | ||
| log.info("만료된 미팅 전체 취소 요청 {}건을 처리했습니다.", expiredCount); | ||
| } | ||
| } | ||
| } |
30 changes: 30 additions & 0 deletions
30
...abom_server/manabom/application/meeting/service/MeetingCancellationExpirationService.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package mannabom_server.manabom.application.meeting.service; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
| import mannabom_server.manabom.domain.meeting.entity.MeetingCancellationRequest; | ||
| import mannabom_server.manabom.domain.meeting.repository.MeetingCancellationRequestRepository; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Propagation; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| import java.time.Instant; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| public class MeetingCancellationExpirationService { | ||
|
|
||
| private final MeetingCancellationRequestRepository requestRepository; | ||
|
|
||
| @Transactional(propagation = Propagation.REQUIRES_NEW) | ||
| public boolean expire(Long requestId, Instant now) { | ||
| MeetingCancellationRequest request = requestRepository.findByIdForUpdate(requestId) | ||
| .orElse(null); | ||
|
|
||
| if (request == null || !request.isExpiredAt(now)) { | ||
| return false; | ||
| } | ||
|
|
||
| request.expire(now); | ||
| return true; | ||
| } | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.