Skip to content

Commit

Permalink
[fix] #169 댓글 조회 API body -> parameter 로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
2hyunjinn committed Jan 22, 2025
1 parent 60565dd commit 8ae4a30
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,14 +22,24 @@ public class CommentController {
private final JwtService jwtService;

@PostMapping("/comment")
public ResponseEntity<ApiResponse<WriteCommentResponse>> writeComment(@RequestHeader("Authorization") final String token, @RequestBody @Valid final WriteCommentRequest dto){
public ResponseEntity<ApiResponse<WriteCommentResponse>> 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<ApiResponse<ReadCommentResponse>> getComments(@RequestHeader("Authorization") final String token, @RequestParam boolean isPublic, @RequestBody final ReadCommentRequest dto){
public ResponseEntity<ApiResponse<ReadCommentResponse>> 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));
}

Expand Down

0 comments on commit 8ae4a30

Please sign in to comment.