|
1 | 1 | package com.threestar.trainus.domain.comment.controller; |
2 | 2 |
|
| 3 | +import java.util.List; |
| 4 | + |
3 | 5 | import org.springframework.beans.factory.annotation.Value; |
4 | 6 | import org.springframework.http.HttpStatus; |
5 | 7 | import org.springframework.http.ResponseEntity; |
|
14 | 16 |
|
15 | 17 | import com.threestar.trainus.domain.comment.dto.CommentCreateRequestDto; |
16 | 18 | import com.threestar.trainus.domain.comment.dto.CommentPageResponseDto; |
17 | | -import com.threestar.trainus.domain.comment.dto.CommentPageWrapperDto; |
18 | 19 | import com.threestar.trainus.domain.comment.dto.CommentResponseDto; |
19 | | -import com.threestar.trainus.domain.comment.mapper.CommentMapper; |
20 | 20 | import com.threestar.trainus.domain.comment.service.CommentService; |
21 | 21 | import com.threestar.trainus.global.annotation.LoginUser; |
22 | 22 | import com.threestar.trainus.global.unit.BaseResponse; |
@@ -47,14 +47,13 @@ public ResponseEntity<BaseResponse<CommentResponseDto>> createComment(@PathVaria |
47 | 47 |
|
48 | 48 | @GetMapping("/{lessonId}") |
49 | 49 | @Operation(summary = "댓글 조회", description = "레슨 ID에 해당되는 댓글들을 조회합니다.") |
50 | | - public ResponseEntity<PagedResponse<CommentPageWrapperDto>> readAll(@PathVariable Long lessonId, |
| 50 | + public ResponseEntity<PagedResponse<List<CommentResponseDto>>> readAll(@PathVariable Long lessonId, |
51 | 51 | @RequestParam("page") int page, |
52 | 52 | @RequestParam("pageSize") int pageSize) { |
53 | 53 | int correctPage = Math.max(page, 1); |
54 | 54 | int correctPageSize = Math.max(1, Math.min(pageSize, pageSizeLimit)); |
55 | 55 | CommentPageResponseDto commentsInfo = commentService.readAll(lessonId, correctPage, correctPageSize); |
56 | | - CommentPageWrapperDto comments = CommentMapper.toCommentPageWrapperDto(commentsInfo); |
57 | | - return PagedResponse.ok("댓글 조회 성공", comments, commentsInfo.getCount(), HttpStatus.OK); |
| 56 | + return PagedResponse.ok("댓글 조회 성공", commentsInfo.comments(), commentsInfo.count(), HttpStatus.OK); |
58 | 57 | } |
59 | 58 |
|
60 | 59 | @DeleteMapping("/{commentId}") |
|
0 commit comments