Skip to content

Commit a28e980

Browse files
committed
refactor: 컨트롤러 코드 수정
1 parent e350c50 commit a28e980

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

src/main/java/com/threestar/trainus/domain/comment/controller/CommentController.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.threestar.trainus.domain.comment.controller;
22

3+
import java.util.List;
4+
35
import org.springframework.beans.factory.annotation.Value;
46
import org.springframework.http.HttpStatus;
57
import org.springframework.http.ResponseEntity;
@@ -14,9 +16,7 @@
1416

1517
import com.threestar.trainus.domain.comment.dto.CommentCreateRequestDto;
1618
import com.threestar.trainus.domain.comment.dto.CommentPageResponseDto;
17-
import com.threestar.trainus.domain.comment.dto.CommentPageWrapperDto;
1819
import com.threestar.trainus.domain.comment.dto.CommentResponseDto;
19-
import com.threestar.trainus.domain.comment.mapper.CommentMapper;
2020
import com.threestar.trainus.domain.comment.service.CommentService;
2121
import com.threestar.trainus.global.annotation.LoginUser;
2222
import com.threestar.trainus.global.unit.BaseResponse;
@@ -47,14 +47,13 @@ public ResponseEntity<BaseResponse<CommentResponseDto>> createComment(@PathVaria
4747

4848
@GetMapping("/{lessonId}")
4949
@Operation(summary = "댓글 조회", description = "레슨 ID에 해당되는 댓글들을 조회합니다.")
50-
public ResponseEntity<PagedResponse<CommentPageWrapperDto>> readAll(@PathVariable Long lessonId,
50+
public ResponseEntity<PagedResponse<List<CommentResponseDto>>> readAll(@PathVariable Long lessonId,
5151
@RequestParam("page") int page,
5252
@RequestParam("pageSize") int pageSize) {
5353
int correctPage = Math.max(page, 1);
5454
int correctPageSize = Math.max(1, Math.min(pageSize, pageSizeLimit));
5555
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);
5857
}
5958

6059
@DeleteMapping("/{commentId}")

src/main/java/com/threestar/trainus/domain/comment/dto/CommentPageWrapperDto.java

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)