Merge branch 'Be/Board' into 'backend'
[Back-End] feat : 게시판 조회 최신순 조회로 변경 See merge request s11-webmobile1-sub2/S11P12A701!99
This commit is contained in:
commit
8c936e1762
@ -38,7 +38,7 @@ public class BoardController {
|
||||
List<ResponseBoardSummaryDto> boardSummaries = boardService.findBoards(pageNo, category, lectureId);
|
||||
|
||||
if(boardSummaries.isEmpty())
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
return new ResponseEntity<>(boardSummaries, HttpStatus.NO_CONTENT);
|
||||
|
||||
return new ResponseEntity<>(boardSummaries, HttpStatus.OK);
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import com.edufocus.edufocus.user.model.entity.vo.User;
|
||||
import com.edufocus.edufocus.user.model.repository.UserRepository;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -39,7 +40,7 @@ public class BoardServiceImpl implements BoardService {
|
||||
|
||||
@Transactional
|
||||
public List<ResponseBoardSummaryDto> findBoards(int pageNo, String category, long lectureId) {
|
||||
Pageable pageable = PageRequest.of(pageNo, PAGE_SIZE);
|
||||
Pageable pageable = PageRequest.of(pageNo, PAGE_SIZE, Sort.by("created_at").descending());
|
||||
|
||||
List<Board> boards = boardRepository.findByLectureIdAndCategory(lectureId, category, pageable).getContent();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user