From e37088c7ee366bb75e3ac63d4d59155f871378ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A0=95=EB=AF=BC?= Date: Mon, 12 Aug 2024 09:54:06 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20qna=20page=EB=B3=80=EC=88=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/edufocus/edufocus/qna/controller/QnaController.java | 4 ++-- .../java/com/edufocus/edufocus/qna/service/QnaService.java | 2 +- .../com/edufocus/edufocus/qna/service/QnaServiceImpl.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/qna/controller/QnaController.java b/backend/src/main/java/com/edufocus/edufocus/qna/controller/QnaController.java index dbc8c5b..7fafb44 100644 --- a/backend/src/main/java/com/edufocus/edufocus/qna/controller/QnaController.java +++ b/backend/src/main/java/com/edufocus/edufocus/qna/controller/QnaController.java @@ -146,9 +146,9 @@ public class QnaController { @GetMapping("/all/{id}") public ResponseEntity> getAllQna( @PathVariable Long id, - @RequestParam(defaultValue = "0") int page) { + @RequestParam(defaultValue = "0") int pageNo) { try { - List qnaList = qnaService.getAllQnasByLecture(id, page, PAGE_SIZE); + List qnaList = qnaService.getAllQnasByLecture(id, pageNo, PAGE_SIZE); return new ResponseEntity<>(qnaList, HttpStatus.ACCEPTED); } catch (SQLException e) { return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE); diff --git a/backend/src/main/java/com/edufocus/edufocus/qna/service/QnaService.java b/backend/src/main/java/com/edufocus/edufocus/qna/service/QnaService.java index c8468aa..6308a95 100644 --- a/backend/src/main/java/com/edufocus/edufocus/qna/service/QnaService.java +++ b/backend/src/main/java/com/edufocus/edufocus/qna/service/QnaService.java @@ -22,7 +22,7 @@ public interface QnaService { QnaResponseDto getQna(Long id, Long userId) throws SQLException; - List getAllQnasByLecture(Long lectureId, int page, int pageNumber) throws SQLException; + List getAllQnasByLecture(Long lectureId, int pageNo, int pageNumber) throws SQLException; QnaResponseDto createAnswer(Long id, QnaRequestDto qnaRequestDto) throws SQLException; diff --git a/backend/src/main/java/com/edufocus/edufocus/qna/service/QnaServiceImpl.java b/backend/src/main/java/com/edufocus/edufocus/qna/service/QnaServiceImpl.java index b2b346a..a60b3d9 100644 --- a/backend/src/main/java/com/edufocus/edufocus/qna/service/QnaServiceImpl.java +++ b/backend/src/main/java/com/edufocus/edufocus/qna/service/QnaServiceImpl.java @@ -120,8 +120,8 @@ public class QnaServiceImpl implements QnaService { } @Override - public List getAllQnasByLecture(Long lectureId, int page, int pageSize) { - Pageable pageable = PageRequest.of(page, pageSize); + public List getAllQnasByLecture(Long lectureId, int pageNo, int pageSize) { + Pageable pageable = PageRequest.of(pageNo, pageSize); Page qnaPage = qnaRepository.findByLectureId(lectureId, pageable); return qnaPage.getContent().stream()