Skip to content

Commit

Permalink
fix: 조건별(장소, 날짜, 포지션별) 게스트 모집글 조회 기능에서 종료된 경기는 조회되지 않도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesuu committed Nov 29, 2023
1 parent c827d15 commit 04f41e6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
4 changes: 4 additions & 0 deletions src/main/java/kr/pickple/back/game/domain/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ private Boolean isClosedGame() {
return status == CLOSED;
}

public Boolean isNotEndedGame() {
return status != ENDED;
}

private Boolean isFullGame() {
return memberCount.equals(maxMemberCount);
}
Expand Down
33 changes: 17 additions & 16 deletions src/main/java/kr/pickple/back/game/service/GameService.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
package kr.pickple.back.game.service;

import static kr.pickple.back.chat.domain.RoomType.*;
import static kr.pickple.back.common.domain.RegistrationStatus.*;
import static kr.pickple.back.game.exception.GameExceptionCode.*;
import static kr.pickple.back.member.exception.MemberExceptionCode.*;

import java.text.MessageFormat;
import java.time.format.DateTimeFormatter;
import java.util.List;

import org.locationtech.jts.geom.Point;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import kr.pickple.back.address.dto.response.MainAddressResponse;
import kr.pickple.back.address.service.AddressService;
import kr.pickple.back.address.service.kakao.KakaoAddressSearchClient;
Expand Down Expand Up @@ -28,22 +44,6 @@
import kr.pickple.back.member.exception.MemberException;
import kr.pickple.back.member.repository.MemberRepository;
import lombok.RequiredArgsConstructor;
import org.locationtech.jts.geom.Point;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.text.MessageFormat;
import java.time.format.DateTimeFormatter;
import java.util.List;

import static kr.pickple.back.chat.domain.RoomType.GAME;
import static kr.pickple.back.common.domain.RegistrationStatus.CONFIRMED;
import static kr.pickple.back.common.domain.RegistrationStatus.WAITING;
import static kr.pickple.back.game.exception.GameExceptionCode.*;
import static kr.pickple.back.member.exception.MemberExceptionCode.MEMBER_NOT_FOUND;

@Service
@RequiredArgsConstructor
Expand Down Expand Up @@ -155,6 +155,7 @@ private List<GameResponse> findGamesByAddress(final String address, final Pageab
);

return games.stream()
.filter(Game::isNotEndedGame)
.map(game -> GameResponse.of(game, getMemberResponses(game, CONFIRMED)))
.toList();
}
Expand Down

0 comments on commit 04f41e6

Please sign in to comment.