55import com .back .domain .post .post .dto .response .PostResponseDto ;
66import com .back .domain .post .post .service .PostService ;
77import com .back .global .rsData .RsData ;
8+ import io .swagger .v3 .oas .annotations .Operation ;
9+ import io .swagger .v3 .oas .annotations .tags .Tag ;
810import jakarta .validation .Valid ;
911import java .util .List ;
1012import lombok .RequiredArgsConstructor ;
1517import org .springframework .web .bind .annotation .PostMapping ;
1618import org .springframework .web .bind .annotation .RequestBody ;
1719import org .springframework .web .bind .annotation .RequestMapping ;
20+ import org .springframework .web .bind .annotation .RequestParam ;
1821import org .springframework .web .bind .annotation .RestController ;
1922
2023@ RestController
2124@ RequestMapping ("/api/posts" )
25+ @ Tag (name = "ApiPostController" , description = "API 게시글 컨트롤러" )
2226@ RequiredArgsConstructor
2327public class PostController {
2428
@@ -30,6 +34,7 @@ public class PostController {
3034 * @return 작성된 게시글 정보
3135 */
3236 @ PostMapping
37+ @ Operation (summary = "게시글 작성" )
3338 public RsData <PostResponseDto > createPost (
3439 @ Valid @ RequestBody PostCreateRequestDto reqBody
3540 ) {
@@ -38,11 +43,15 @@ public RsData<PostResponseDto> createPost(
3843
3944 /**
4045 * 게시글 다건 조회 API
41- * @return 모든 게시글 리스트
46+ * @param lastId 마지막으로 조회한 게시글 ID (페이징 처리용, optional)
47+ * @return 게시글 목록
4248 */
4349 @ GetMapping
44- public RsData <List <PostResponseDto >> getAllPosts () {
45- return RsData .successOf (postService .getAllPosts ()); // code=200, message="success"
50+ @ Operation (summary = "게시글 다건 조회" )
51+ public RsData <List <PostResponseDto >> getAllPosts (
52+ @ RequestParam (required = false ) Long lastId
53+ ) {
54+ return RsData .successOf (postService .getAllPosts (lastId )); // code=200, message="success"
4655 }
4756
4857 /**
@@ -51,6 +60,7 @@ public RsData<List<PostResponseDto>> getAllPosts() {
5160 * @return 해당 ID의 게시글 정보
5261 */
5362 @ GetMapping ("/{postId}" )
63+ @ Operation (summary = "게시글 단건 조회" )
5464 public RsData <PostResponseDto > getPost (
5565 @ PathVariable Long postId
5666 ) {
@@ -64,6 +74,7 @@ public RsData<PostResponseDto> getPost(
6474 * @return 수정된 게시글 정보
6575 */
6676 @ PatchMapping ("/{postId}" )
77+ @ Operation (summary = "게시글 수정" )
6778 public RsData <PostResponseDto > updatePost (
6879 @ PathVariable Long postId ,
6980 @ Valid @ RequestBody PostUpdateRequestDto reqBody
@@ -77,6 +88,7 @@ public RsData<PostResponseDto> updatePost(
7788 * @return 삭제 성공 메시지
7889 */
7990 @ DeleteMapping ("/{postId}" )
91+ @ Operation (summary = "게시글 삭제" )
8092 public RsData <Void > deletePost (
8193 @ PathVariable Long postId
8294 ) {
0 commit comments