-
Notifications
You must be signed in to change notification settings - Fork 0
✨ Feat: Match 도메인 조회 API 추가 (참가자 목록 / 구장 기반 매칭) #72
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,3 +43,4 @@ src/main/resources/*.yml | |
|
|
||
| # 기타 | ||
| CLAUDE.md | ||
| Makefile | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |||||||||||||||||
| import com.be.sportizebe.domain.match.dto.request.MatchNearRequest; | ||||||||||||||||||
| import com.be.sportizebe.domain.match.dto.response.MatchDetailResponse; | ||||||||||||||||||
| import com.be.sportizebe.domain.match.dto.response.MatchNearResponse; | ||||||||||||||||||
| import com.be.sportizebe.domain.match.dto.response.MatchParticipantResponse; | ||||||||||||||||||
| import com.be.sportizebe.domain.match.dto.response.MatchResponse; | ||||||||||||||||||
| import com.be.sportizebe.domain.match.dto.response.MyMatchResponse; | ||||||||||||||||||
| import com.be.sportizebe.domain.match.entity.MatchParticipant; | ||||||||||||||||||
|
|
@@ -23,6 +24,7 @@ | |||||||||||||||||
| import org.springframework.stereotype.Service; | ||||||||||||||||||
| import org.springframework.transaction.annotation.Transactional; | ||||||||||||||||||
| import com.be.sportizebe.domain.match.dto.request.MatchCreateRequest; | ||||||||||||||||||
| import java.time.LocalDateTime; | ||||||||||||||||||
| import java.util.List; | ||||||||||||||||||
| import java.util.Optional; | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -165,6 +167,33 @@ public List<MyMatchResponse> getMyMatches(Long userId) { | |||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| @Override | ||||||||||||||||||
| @Transactional(readOnly = true) | ||||||||||||||||||
| public List<MatchParticipantResponse> getMatchParticipants(Long matchId) { | ||||||||||||||||||
| if (!matchRoomRepository.existsById(matchId)) { | ||||||||||||||||||
| throw new CustomException(MatchErrorCode.MATCH_NOT_FOUND); | ||||||||||||||||||
| } | ||||||||||||||||||
| return matchParticipantRepository | ||||||||||||||||||
| .findAllByMatchRoomIdAndStatusFetch(matchId, MatchParticipantStatus.JOINED) | ||||||||||||||||||
| .stream() | ||||||||||||||||||
| .map(MatchParticipantResponse::from) | ||||||||||||||||||
| .toList(); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| @Override | ||||||||||||||||||
| @Transactional(readOnly = true) | ||||||||||||||||||
| public List<MatchResponse> getMatchesByFacility(Long facilityId) { | ||||||||||||||||||
| return matchRoomRepository | ||||||||||||||||||
| .findByFacilityIdAndStatusInAndScheduledAtAfterOrderByScheduledAtAsc( | ||||||||||||||||||
| facilityId, | ||||||||||||||||||
| List.of(MatchStatus.OPEN, MatchStatus.FULL), | ||||||||||||||||||
| LocalDateTime.now() | ||||||||||||||||||
|
Comment on lines
+186
to
+189
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. 구장 조회 API가 요구사항보다 넓은 상태를 반환합니다. linked issue 요구사항에 맞추는 예시 return matchRoomRepository
.findByFacilityIdAndStatusInAndScheduledAtAfterOrderByScheduledAtAsc(
facilityId,
- List.of(MatchStatus.OPEN, MatchStatus.FULL),
+ List.of(MatchStatus.OPEN),
LocalDateTime.now()
)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
| ) | ||||||||||||||||||
| .stream() | ||||||||||||||||||
| .map(MatchResponse::from) | ||||||||||||||||||
| .toList(); | ||||||||||||||||||
|
Comment on lines
+184
to
+193
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. 존재하지 않는 지금 구현은 잘못된 구장 존재 여부를 먼저 검증하는 예시 `@Override`
`@Transactional`(readOnly = true)
public List<MatchResponse> getMatchesByFacility(Long facilityId) {
+ if (!sportsFacilityRepository.existsById(facilityId)) {
+ throw new CustomException(FacilityErrorCode.FACILITY_NOT_FOUND);
+ }
+
return matchRoomRepository
.findByFacilityIdAndStatusInAndScheduledAtAfterOrderByScheduledAtAsc(
facilityId,
List.of(MatchStatus.OPEN, MatchStatus.FULL),
LocalDateTime.now()
)🤖 Prompt for AI Agents |
||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| @Override | ||||||||||||||||||
| @Transactional(readOnly = true) | ||||||||||||||||||
| public List<MatchNearResponse> getNearMatches(MatchNearRequest request) { | ||||||||||||||||||
| String sportsName = request.getSportsName() == null | ||||||||||||||||||
|
|
||||||||||||||||||
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.
참가자 목록 정렬 기준을 쿼리에 고정해 주세요.
현재 쿼리는
ORDER BY가 없어 응답 순서가 DB 실행 계획에 따라 바뀔 수 있습니다. 사용자 목록을 그대로 노출하는 API라면 가입 순서 등 의도한 기준을 명시하는 편이 안전합니다.정렬 기준을 명시하는 예시
🤖 Prompt for AI Agents