diff --git a/src/main/java/org/depromeet/sambad/moring/meeting/comment/presentation/comment/MeetingQuestionCommentController.java b/src/main/java/org/depromeet/sambad/moring/meeting/comment/presentation/comment/MeetingQuestionCommentController.java index 60da09c7..8b01fbc0 100644 --- a/src/main/java/org/depromeet/sambad/moring/meeting/comment/presentation/comment/MeetingQuestionCommentController.java +++ b/src/main/java/org/depromeet/sambad/moring/meeting/comment/presentation/comment/MeetingQuestionCommentController.java @@ -48,7 +48,8 @@ public ResponseEntity saveComment( @Operation(summary = "릴레이 질문에 대한 모든 코멘트 조회", description = "모임의 릴레이 질문에 대한 모든 코멘트를 조회합니다.") @ApiResponses(value = { - @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "200", description = "릴레이 질문에 대한 코멘트 목록 조회 성공"), + @ApiResponse(responseCode = "204", description = "릴레이 질문에 대한 코멘트 없음"), @ApiResponse(responseCode = "404", description = "NOT_FOUND_QUESTION") }) @GetMapping("/meetings/{meetingId}/questions/{meetingQuestionId}/comments") @@ -57,9 +58,9 @@ public ResponseEntity getComments( @Parameter(description = "모임 ID", example = "1", required = true) @PathVariable("meetingId") @Positive Long meetingId, @Parameter(description = "모임 질문 ID", example = "1", required = true) @PathVariable("meetingQuestionId") @Positive Long meetingQuestionId ) { - MeetingCommentListResponse comments = meetingQuestionCommentService.getAllComments(userId, meetingId, + MeetingCommentListResponse response = meetingQuestionCommentService.getAllComments(userId, meetingId, meetingQuestionId); - return ResponseEntity.ok(comments); + return response.toResponseEntity(); } @Operation(summary = "릴레이 질문 코멘트 삭제", description = "모임의 릴레이 질문 코멘트를 삭제합니다.") diff --git a/src/main/java/org/depromeet/sambad/moring/meeting/comment/presentation/comment/response/MeetingCommentListResponse.java b/src/main/java/org/depromeet/sambad/moring/meeting/comment/presentation/comment/response/MeetingCommentListResponse.java index 030f1f11..985c1928 100644 --- a/src/main/java/org/depromeet/sambad/moring/meeting/comment/presentation/comment/response/MeetingCommentListResponse.java +++ b/src/main/java/org/depromeet/sambad/moring/meeting/comment/presentation/comment/response/MeetingCommentListResponse.java @@ -1,10 +1,11 @@ package org.depromeet.sambad.moring.meeting.comment.presentation.comment.response; -import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.*; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import java.util.List; import org.depromeet.sambad.moring.meeting.comment.domain.comment.MeetingQuestionComment; +import org.springframework.http.ResponseEntity; import io.swagger.v3.oas.annotations.media.Schema; @@ -19,4 +20,10 @@ public record MeetingCommentListResponse( public static MeetingCommentListResponse from(List comments) { return new MeetingCommentListResponse(MeetingCommentListResponseDetail.from(comments)); } + + public ResponseEntity toResponseEntity() { + return contents.isEmpty() + ? ResponseEntity.noContent().build() + : ResponseEntity.ok(this); + } }