Skip to content

Commit 598ea61

Browse files
committed
fix : 광고 조회시 업로드일자 기준으로 조회하도록 수정
1 parent 8f04ea2 commit 598ea61

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

kobaco/kobaco/src/main/java/core/kobaco/infra/jpa/advertisement/AdvertisementRepositoryImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public Page<Advertisement> findSavedAllByUserId(Pageable pageable, Long userId)
4545
public Page<Advertisement> findAllWithKeyword(Pageable pageable, List<String> keywordList, OrderType orderType) {
4646
if(Objects.isNull(keywordList)||keywordList.isEmpty()){
4747
if(orderType.equals(OrderType.RECENT)){
48-
return advertisementJpaRepository.findAll(pageable)
48+
return advertisementJpaRepository.findAllOrderByUploadDateDesc(pageable)
4949
.map(advertiseMapper::toDomain);
5050
}
5151
if(orderType.equals(OrderType.POPULAR)){

kobaco/kobaco/src/main/java/core/kobaco/infra/jpa/advertisement/repository/AdvertisementJpaRepository.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,11 @@ having count(distinct ak.keyword) = :keywordSize
124124
where ae.id = :advertiseId
125125
""")
126126
void updateViewCount(Long advertiseId);
127+
128+
@Query("""
129+
select ae
130+
from AdvertisementEntity ae
131+
order by ae.uploadDate desc
132+
""")
133+
Page<AdvertisementEntity> findAllOrderByUploadDateDesc(Pageable pageable);
127134
}

0 commit comments

Comments
 (0)