44import com .back .domain .comment .dto .CommentResponse ;
55import com .back .domain .comment .enums .CommentSortType ;
66import com .back .domain .comment .service .CommentService ;
7- import com .back .domain .post .dto .PostSummaryResponse ;
87import com .back .global .common .ApiResponse ;
98import com .back .global .common .PageResponse ;
109import io .swagger .v3 .oas .annotations .Operation ;
@@ -66,35 +65,26 @@ public ApiResponse<PageResponse<CommentResponse>> getPosts(
6665 return ApiResponse .success (PageResponse .of (responses ), "성공적으로 조회되었습니다." , HttpStatus .OK );
6766 }
6867
69- // // 게시글 단건 조회
70- // @GetMapping("/{postId}")
71- // @Operation(summary = "게시글 상세 조회", description = "게시글 ID로 게시글을 조회합니다.")
72- // public ApiResponse<PostDetailResponse> getPost(
73- // @Parameter(description = "조회할 게시글 ID", required = true) @PathVariable Long postId,
74- // @RequestParam Long userId) {
75- // return ApiResponse.success(postService.getPost(userId, postId), "성공적으로 조회되었습니다.", HttpStatus.OK);
76- // }
77- //
78- // @PutMapping("/{postId}")
79- // @Operation(summary = "게시글 수정", description = "게시글 ID로 게시글을 수정합니다.")
80- // public ApiResponse<Long> updatePost(
81- // @Parameter(description = "수정할 게시글 ID", required = true) @PathVariable Long postId,
82- // @io.swagger.v3.oas.annotations.parameters.RequestBody(
83- // description = "수정할 게시글 정보",
84- // required = true
85- // )
86- // @RequestBody @Valid PostRequest request,
87- // @RequestParam Long userId) {
88- // return ApiResponse.success(postService.updatePost(userId, postId, request), "성공적으로 수정되었습니다.", HttpStatus.OK);
89- // }
90- //
91- // @DeleteMapping("/{postId}")
92- // @Operation(summary = "게시글 삭제", description = "게시글 ID로 게시글을 삭제합니다.")
93- // public ApiResponse<Void> deletePost(
94- // @Parameter(description = "삭제할 게시글 ID", required = true) @PathVariable Long postId,
95- // @RequestParam Long userId) {
96- // postService.deletePost(userId, postId);
97- // return ApiResponse.success(null, "성공적으로 삭제되었습니다.", HttpStatus.OK);
98- // }
9968
69+ @ PutMapping ("/{commentId}" )
70+ @ Operation (summary = "댓글 수정" , description = "자신의 댓글을 수정합니다." )
71+ public ApiResponse <Long > updateComment (
72+ @ Parameter (description = "수정할 댓글 ID" , required = true ) @ PathVariable Long commentId ,
73+ @ io .swagger .v3 .oas .annotations .parameters .RequestBody (
74+ description = "수정할 댓글 정보" ,
75+ required = true
76+ )
77+ @ RequestBody @ Valid CommentRequest request ,
78+ @ RequestParam Long userId ) {
79+ return ApiResponse .success (commentService .updateComment (userId , commentId , request ), "성공적으로 수정되었습니다." , HttpStatus .OK );
80+ }
81+
82+ @ DeleteMapping ("/{commentId}" )
83+ @ Operation (summary = "댓글 삭제" , description = "자신의 댓글을 삭제합니다." )
84+ public ApiResponse <Void > deletePost (
85+ @ Parameter (description = "삭제할 댓글 ID" , required = true ) @ PathVariable Long commentId ,
86+ @ RequestParam Long userId ) {
87+ commentService .deleteComment (userId , commentId );
88+ return ApiResponse .success (null , "성공적으로 삭제되었습니다." , HttpStatus .OK );
89+ }
10090}
0 commit comments