Skip to content

Commit

Permalink
fix: 전체 목록 내림차순으로 조회
Browse files Browse the repository at this point in the history
  • Loading branch information
g16rim committed Nov 6, 2023
1 parent 261e634 commit e104fd2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.realWriting.note.application.port.out.NotePersistencePort;
import com.realWriting.note.domain.Note;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Component;

import java.util.List;
Expand Down Expand Up @@ -33,7 +34,7 @@ public void delete(Long id) {

@Override
public List<Note> findAllByUserId(Long userId) {
return noteRepository.findAllByUserId(userId);
return noteRepository.findAllByUserId(userId, Sort.by(Sort.Order.desc("id")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@

@Repository
public interface NoteRepository extends JpaRepository<Note, Long> {
List<Note> findAllByUserId(Long userId);
List<Note> findAllByUserId(Long userId, Sort sort);
}

0 comments on commit e104fd2

Please sign in to comment.