Skip to content

Commit

Permalink
Merge branch 'dev' into NABI-255--junhyuk--fix--card-list-read-with-c…
Browse files Browse the repository at this point in the history
…ursor-paging
  • Loading branch information
hi-june committed Nov 18, 2023
2 parents 91c9f19 + 0f9f1f4 commit e7e1204
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ public List<CardSuggestionResponseDTO> getSuggestionAvailableCards(
)
.from(card)
.leftJoin(suggestion).on(suggestion.fromCard.cardId.eq(card.cardId))
.leftJoin(suggestion).on(suggestion.toCard.cardId.eq(targetCardId))
.where(card.user.userId.eq(userId),
suggestion.toCard.cardId.eq(targetCardId).or(suggestion.toCard.cardId.isNull()))
.where(card.user.userId.eq(userId))
.distinct()
.on(suggestion.toCard.cardId.eq(targetCardId))
.fetch();

return cardList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,10 @@ public CardListResponseDTO<CardSuggestionResponseDTO> getSuggestionAvailableCard
Long targetCardId
) {
Long userId = checkService.parseToken(token);

User requestUser = userRepository.findById(userId)
.orElseThrow(() -> new BaseException(ErrorCode.USER_NOT_FOUND));

Card suggestionTargetCard = cardRepository.findById(targetCardId)
.orElseThrow(() -> new BaseException(ErrorCode.CARD_NOT_FOUND));

Expand Down Expand Up @@ -315,7 +317,7 @@ public List<CardSuggestionResponseDTO> getSuggestionResultCardList(
) {
Card targetCard = cardRepository.findById(targetId)
.orElseThrow(() -> new BaseException(ErrorCode.CARD_NOT_FOUND));

Boolean pokeAvailable = targetCard.getPokeAvailable();
PriceRange priceRange = targetCard.getItem().getPriceRange();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import org.prgrms.nabimarketbe.domain.item.entity.Item;

public enum SuggestionType {
OFFER( (fromItem, toItem) -> (fromItem.getPriceRange().equals(toItem.getPriceRange())) ),
OFFER( (fromItem, toItem) -> (fromItem.getPriceRange().equals(toItem.getPriceRange())
|| fromItem.getPriceRange().getValue() > toItem.getPriceRange().getValue()) ),
POKE( (fromItem, toItem) -> (fromItem.getPriceRange().getValue() < toItem.getPriceRange().getValue()) );

public final BiFunction<Item, Item, Boolean> suggestionValidationFunction;
Expand Down

0 comments on commit e7e1204

Please sign in to comment.