Refactor: 리턴타입 List형태로 반환

This commit is contained in:
김용수 2024-09-19 12:12:09 +09:00
parent 4ddf0cf6cb
commit ac31876961
2 changed files with 2 additions and 25 deletions

View File

@ -2,7 +2,6 @@ package com.worlabel.domain.comment.controller;
import com.worlabel.domain.comment.entity.dto.CommentRequest;
import com.worlabel.domain.comment.entity.dto.CommentResponse;
import com.worlabel.domain.comment.entity.dto.CommentResponses;
import com.worlabel.domain.comment.service.CommentService;
import com.worlabel.global.annotation.CurrentUser;
import com.worlabel.global.config.swagger.SwaggerApiError;
@ -27,12 +26,11 @@ public class CommentController {
@SwaggerApiSuccess(description = "댓글 목록을 성공적으로 조회합니다.")
@Operation(summary = "댓글 목록 조회", description = "댓글 목록을 조회합니다.")
@SwaggerApiError({ErrorCode.BAD_REQUEST, ErrorCode.NOT_AUTHOR, ErrorCode.SERVER_ERROR})
public CommentResponses getAllComments(
public List<CommentResponse> getAllComments(
@CurrentUser final Integer memberId,
@PathVariable("project_id") final Integer projectId,
@PathVariable("image_id") final Long imageId) {
List<CommentResponse> comments = commentService.getAllComments(memberId, projectId, imageId);
return CommentResponses.from(comments);
return commentService.getAllComments(memberId, projectId, imageId);
}
@GetMapping("/{comment_id}")

View File

@ -1,21 +0,0 @@
package com.worlabel.domain.comment.entity.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.List;
@Schema(name = "댓글 목록 응답 dto", description = "댓글 목록 응답 DTO")
@Getter
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class CommentResponses {
@Schema(description = "댓글 목록", example = "")
private List<CommentResponse> commentResponses;
public static CommentResponses from(final List<CommentResponse> commentResponses) {
return new CommentResponses(commentResponses);
}
}