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)); }