From f86c37c527099fd185d9d4aeec146431a0b45fe7 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sat, 3 Aug 2024 14:09:49 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9E=84=EC=8B=9C=20API=20=EA=B0=9C?= =?UTF-8?q?=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/crew/main/comment/v2/CommentV2Api.java | 12 ++++++++++++ .../crew/main/comment/v2/CommentV2Controller.java | 14 ++++++++++++++ .../crew/main/common/dto/TempResponseDto.java | 14 ++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 main/src/main/java/org/sopt/makers/crew/main/common/dto/TempResponseDto.java diff --git a/main/src/main/java/org/sopt/makers/crew/main/comment/v2/CommentV2Api.java b/main/src/main/java/org/sopt/makers/crew/main/comment/v2/CommentV2Api.java index 249c7588..35c91070 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/comment/v2/CommentV2Api.java +++ b/main/src/main/java/org/sopt/makers/crew/main/comment/v2/CommentV2Api.java @@ -17,6 +17,7 @@ import org.sopt.makers.crew.main.comment.v2.dto.response.CommentV2GetCommentsResponseDto; import org.sopt.makers.crew.main.comment.v2.dto.response.CommentV2ReportCommentResponseDto; import org.sopt.makers.crew.main.comment.v2.dto.response.CommentV2UpdateCommentResponseDto; +import org.sopt.makers.crew.main.common.dto.TempResponseDto; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ModelAttribute; @@ -78,4 +79,15 @@ ResponseEntity mentionUserInComment( @Parameter(name = "postId", description = "게시글 id", example = "3")}) ResponseEntity getComments( @Valid @ModelAttribute @Parameter(hidden = true) CommentV2GetCommentsQueryDto request, Principal principal); + + @Operation(summary = "[TEMP] 모임 게시글 댓글 리스트 조회") + @ResponseStatus(HttpStatus.OK) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "성공"), + }) + @Parameters({@Parameter(name = "page", description = "페이지, default = 1", example = "1"), + @Parameter(name = "take", description = "가져올 데이터 개수, default = 12", example = "50"), + @Parameter(name = "postId", description = "게시글 id", example = "3")}) + ResponseEntity> getCommentsTemp( + @Valid @ModelAttribute @Parameter(hidden = true) CommentV2GetCommentsQueryDto request, Principal principal); } diff --git a/main/src/main/java/org/sopt/makers/crew/main/comment/v2/CommentV2Controller.java b/main/src/main/java/org/sopt/makers/crew/main/comment/v2/CommentV2Controller.java index f5a056ea..87452f71 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/comment/v2/CommentV2Controller.java +++ b/main/src/main/java/org/sopt/makers/crew/main/comment/v2/CommentV2Controller.java @@ -17,6 +17,7 @@ import org.sopt.makers.crew.main.comment.v2.dto.response.CommentV2ReportCommentResponseDto; import org.sopt.makers.crew.main.comment.v2.dto.response.CommentV2UpdateCommentResponseDto; import org.sopt.makers.crew.main.comment.v2.service.CommentV2Service; +import org.sopt.makers.crew.main.common.dto.TempResponseDto; import org.sopt.makers.crew.main.common.util.UserUtil; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -99,4 +100,17 @@ public ResponseEntity getComments( return ResponseEntity.status(HttpStatus.OK).body(commentDtos); } + + @Override + @GetMapping("/temp") + public ResponseEntity> getCommentsTemp( + @Valid @ModelAttribute @Parameter(hidden = true) CommentV2GetCommentsQueryDto request, + Principal principal) { + + Integer userId = UserUtil.getUserId(principal); + CommentV2GetCommentsResponseDto commentDtos = commentV2Service.getComments(request.getPostId(), + request.getPage(), request.getTake(), userId); + + return ResponseEntity.status(HttpStatus.OK).body(TempResponseDto.of(commentDtos)); + } } diff --git a/main/src/main/java/org/sopt/makers/crew/main/common/dto/TempResponseDto.java b/main/src/main/java/org/sopt/makers/crew/main/common/dto/TempResponseDto.java new file mode 100644 index 00000000..db94f757 --- /dev/null +++ b/main/src/main/java/org/sopt/makers/crew/main/common/dto/TempResponseDto.java @@ -0,0 +1,14 @@ +package org.sopt.makers.crew.main.common.dto; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class TempResponseDto { + private T data; + + public static TempResponseDto of(T data) { + return new TempResponseDto(data); + } +}