Skip to content

Commit

Permalink
[ADD] 인사이트 리스트 조회 시, 정렬 조건 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
yeseul106 committed Jan 4, 2024
1 parent a122496 commit cad0030
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

public interface SeedRepository extends JpaRepository<Seed, Long> {
Optional<Seed> findSeedById(Long seedId);
List<Seed> findAllByCaveId(Long caveId);
List<Seed> findByCaveIdOrderByIdDesc(Long caveId);

default Seed findSeedByIdOrThrow(Long seedId) {
return findSeedById(seedId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public SeedMoveResponseDto moveSeed(Long seedId, SeedMoveRequestDto seedMoveRequ

@Override
public List<SeedListByCaveGetResponseDto> getSeedListByCave(Long caveId) {
return seedRepository.findAllByCaveId(caveId).stream()
return seedRepository.findByCaveIdOrderByIdDesc(caveId).stream()
.map(seed -> SeedListByCaveGetResponseDto.of(seed.getId(), seed.getInsight(), calculateRemainingDays(seed.getLockDate()),
seed.getIsLocked(), seed.getIsScraped(), checkHasActionPlan(seed)))
.collect(Collectors.toList());
Expand Down

0 comments on commit cad0030

Please sign in to comment.