From 8ae4a3015f1717eea3750165cd4bc2b2f5a645e6 Mon Sep 17 00:00:00 2001 From: 2hyunjinn Date: Wed, 22 Jan 2025 23:39:59 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20#169=20=EB=8C=93=EA=B8=80=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20API=20body=20->=20parameter=20=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/comment/controller/CommentController.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/ggang/be/api/comment/controller/CommentController.java b/src/main/java/com/ggang/be/api/comment/controller/CommentController.java index f3bc404..bacb247 100644 --- a/src/main/java/com/ggang/be/api/comment/controller/CommentController.java +++ b/src/main/java/com/ggang/be/api/comment/controller/CommentController.java @@ -7,6 +7,7 @@ import com.ggang.be.api.comment.facade.CommentFacade; import com.ggang.be.api.common.ApiResponse; import com.ggang.be.api.common.ResponseBuilder; +import com.ggang.be.domain.constant.GroupType; import com.ggang.be.global.jwt.JwtService; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -21,14 +22,24 @@ public class CommentController { private final JwtService jwtService; @PostMapping("/comment") - public ResponseEntity> writeComment(@RequestHeader("Authorization") final String token, @RequestBody @Valid final WriteCommentRequest dto){ + public ResponseEntity> writeComment( + @RequestHeader("Authorization") final String token, + @RequestBody @Valid final WriteCommentRequest dto + ) { Long userId = jwtService.parseTokenAndGetUserId(token); return ResponseBuilder.created(commentFacade.writeComment(userId, dto)); } @GetMapping("/comments") - public ResponseEntity> getComments(@RequestHeader("Authorization") final String token, @RequestParam boolean isPublic, @RequestBody final ReadCommentRequest dto){ + public ResponseEntity> getComments( + @RequestHeader("Authorization") final String token, + @RequestParam boolean isPublic, + @RequestParam("groupId") long groupId, + @RequestParam("groupType") GroupType groupType + ) { Long userId = jwtService.parseTokenAndGetUserId(token); + ReadCommentRequest dto = new ReadCommentRequest(groupId, groupType); + return ResponseBuilder.ok(commentFacade.readComment(userId, isPublic, dto)); }