Skip to content

Commit

Permalink
feat: 방문 리스트 없을때만 넣기
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeongh00 committed Aug 1, 2024
1 parent ddd8546 commit ab4ba1b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,18 @@ public HomeInfo findMarketLists(String accessToken) {
totalStoreVisits += storeVisitList.size();
}

VisitListHome visitListHome = new VisitListHome(
market.getId(),
market.getName(),
market.getImageUrl(),
market.getLocation(),
storeList.size(),
totalStoreVisits,
market.getCreatedAt().toLocalDate()
);
visitListHomeList.add(visitListHome);
if (marketQueryService.findMyMarketVisit(market.getId(), user.getUserId()) > 0) {
VisitListHome visitListHome = new VisitListHome(
market.getId(),
market.getName(),
market.getImageUrl(),
market.getLocation(),
storeList.size(),
totalStoreVisits,
market.getCreatedAt().toLocalDate()
);
visitListHomeList.add(visitListHome);
}

MarketQrVisit marketQrVisit = marketQueryService.findMarketVisit(market.getId());
int qrVisit = (marketQrVisit != null) ? marketQrVisit.getQrVisit() : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
public interface MarketQrVisitRepository extends JpaRepository<MarketQrVisit, Long> {

MarketQrVisit findByMarketId(Long marketId);

Integer countAllByMarketIdAndUserUserId(Long marketId, Long userId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public MarketQrVisit findMarketVisit(Long marketId) {
return marketQrVisitRepository.findByMarketId(marketId);
}

public Integer findMyMarketVisit(Long marketId, Long userId) {
return marketQrVisitRepository.countAllByMarketIdAndUserUserId(marketId, userId);
}

public void saveVisitList(Long storeId, String email) {

User user = userQueryService.findByEmail(email);
Expand Down

0 comments on commit ab4ba1b

Please sign in to comment.