Refactor: 리턴타입 List형태로 반환
This commit is contained in:
parent
4ddf0cf6cb
commit
ac31876961
@ -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.CommentRequest;
|
||||||
import com.worlabel.domain.comment.entity.dto.CommentResponse;
|
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.domain.comment.service.CommentService;
|
||||||
import com.worlabel.global.annotation.CurrentUser;
|
import com.worlabel.global.annotation.CurrentUser;
|
||||||
import com.worlabel.global.config.swagger.SwaggerApiError;
|
import com.worlabel.global.config.swagger.SwaggerApiError;
|
||||||
@ -27,12 +26,11 @@ public class CommentController {
|
|||||||
@SwaggerApiSuccess(description = "댓글 목록을 성공적으로 조회합니다.")
|
@SwaggerApiSuccess(description = "댓글 목록을 성공적으로 조회합니다.")
|
||||||
@Operation(summary = "댓글 목록 조회", description = "댓글 목록을 조회합니다.")
|
@Operation(summary = "댓글 목록 조회", description = "댓글 목록을 조회합니다.")
|
||||||
@SwaggerApiError({ErrorCode.BAD_REQUEST, ErrorCode.NOT_AUTHOR, ErrorCode.SERVER_ERROR})
|
@SwaggerApiError({ErrorCode.BAD_REQUEST, ErrorCode.NOT_AUTHOR, ErrorCode.SERVER_ERROR})
|
||||||
public CommentResponses getAllComments(
|
public List<CommentResponse> getAllComments(
|
||||||
@CurrentUser final Integer memberId,
|
@CurrentUser final Integer memberId,
|
||||||
@PathVariable("project_id") final Integer projectId,
|
@PathVariable("project_id") final Integer projectId,
|
||||||
@PathVariable("image_id") final Long imageId) {
|
@PathVariable("image_id") final Long imageId) {
|
||||||
List<CommentResponse> comments = commentService.getAllComments(memberId, projectId, imageId);
|
return commentService.getAllComments(memberId, projectId, imageId);
|
||||||
return CommentResponses.from(comments);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{comment_id}")
|
@GetMapping("/{comment_id}")
|
||||||
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user