Skip to content

Commit

Permalink
Merge pull request #211 from SKY-HORSE-MAN-POWER/refactor/#210
Browse files Browse the repository at this point in the history
refactor: 입찰 검사 인자에 auctionUuid 추가(#210)
  • Loading branch information
chanchanwoong authored Jun 23, 2024
2 parents b531ae2 + 1b3502c commit 0751774
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ private void isBiddingPossible(OfferBiddingPriceDto offerBiddingPriceDto, RoundI
log.info("입찰 시간 통과");

// 조건2. 해당 라운드에 참여 여부
checkBiddingRound(offerBiddingPriceDto.getBiddingUuid(), offerBiddingPriceDto.getRound());
checkBiddingRound(offerBiddingPriceDto.getAuctionUuid(), offerBiddingPriceDto.getBiddingUuid(),
offerBiddingPriceDto.getRound());
log.info("현재 라운드에 참여한 적 없음");

// 조건3. 남은 인원이 1 이상
Expand All @@ -208,8 +209,9 @@ private void isBiddingPossible(OfferBiddingPriceDto offerBiddingPriceDto, RoundI
log.info("라운드 및 입찰가 통과");
}

private void checkBiddingRound(String biddingUuid, int round) {
if (auctionHistoryRepository.findByBiddingUuidAndRound(biddingUuid, round).isPresent()) {
private void checkBiddingRound(String auctionUuid, String biddingUuid, int round) {
if (auctionHistoryRepository.findByAuctionUuidAndBiddingUuidAndRound(
auctionUuid, biddingUuid, round).isPresent()) {
throw new CustomException(ResponseStatus.ALREADY_BID_IN_ROUND);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface AuctionHistoryRepository extends MongoRepository<AuctionHistory

List<AuctionHistory> findByAuctionUuidAndRoundOrderByBiddingTime(String auctionUuid, int round);

Optional<AuctionHistory> findByBiddingUuidAndRound(String biddingUuid, int round);
Optional<AuctionHistory> findByAuctionUuidAndBiddingUuidAndRound(String auctionUuid, String biddingUuid, int round);

Optional<AuctionHistory> findFirstByAuctionUuidOrderByBiddingTimeDesc(String auctionUuid);
}

0 comments on commit 0751774

Please sign in to comment.