Skip to content

Commit 2b3d630

Browse files
committed
Docs: Swagger 문서 작성
1 parent 40fb4dd commit 2b3d630

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed

src/main/java/com/back/domain/board/controller/PostControllerDocs.java

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,4 +438,123 @@ ResponseEntity<RsData<PostResponse>> updatePost(
438438
@RequestBody PostRequest request,
439439
@AuthenticationPrincipal CustomUserDetails user
440440
);
441+
442+
@Operation(
443+
summary = "게시글 삭제",
444+
description = "로그인한 사용자가 자신의 게시글을 삭제합니다."
445+
)
446+
@ApiResponses({
447+
@ApiResponse(
448+
responseCode = "200",
449+
description = "게시글 삭제 성공",
450+
content = @Content(
451+
mediaType = "application/json",
452+
examples = @ExampleObject(value = """
453+
{
454+
"success": true,
455+
"code": "SUCCESS_200",
456+
"message": "게시글이 삭제되었습니다.",
457+
"data": null
458+
}
459+
""")
460+
)
461+
),
462+
@ApiResponse(
463+
responseCode = "400",
464+
description = "잘못된 요청 (필드 누락 등)",
465+
content = @Content(
466+
mediaType = "application/json",
467+
examples = @ExampleObject(value = """
468+
{
469+
"success": false,
470+
"code": "COMMON_400",
471+
"message": "잘못된 요청입니다.",
472+
"data": null
473+
}
474+
""")
475+
)
476+
),
477+
@ApiResponse(
478+
responseCode = "401",
479+
description = "인증 실패 (토큰 없음/만료/잘못됨)",
480+
content = @Content(
481+
mediaType = "application/json",
482+
examples = {
483+
@ExampleObject(name = "토큰 없음", value = """
484+
{
485+
"success": false,
486+
"code": "AUTH_001",
487+
"message": "인증이 필요합니다.",
488+
"data": null
489+
}
490+
"""),
491+
@ExampleObject(name = "잘못된 토큰", value = """
492+
{
493+
"success": false,
494+
"code": "AUTH_002",
495+
"message": "유효하지 않은 액세스 토큰입니다.",
496+
"data": null
497+
}
498+
"""),
499+
@ExampleObject(name = "만료된 토큰", value = """
500+
{
501+
"success": false,
502+
"code": "AUTH_004",
503+
"message": "만료된 액세스 토큰입니다.",
504+
"data": null
505+
}
506+
""")
507+
}
508+
)
509+
),
510+
@ApiResponse(
511+
responseCode = "403",
512+
description = "권한 없음 (작성자 아님)",
513+
content = @Content(
514+
mediaType = "application/json",
515+
examples = @ExampleObject(value = """
516+
{
517+
"success": false,
518+
"code": "POST_002",
519+
"message": "게시글 작성자만 수정/삭제할 수 있습니다.",
520+
"data": null
521+
}
522+
""")
523+
)
524+
),
525+
@ApiResponse(
526+
responseCode = "404",
527+
description = "존재하지 않는 게시글",
528+
content = @Content(
529+
mediaType = "application/json",
530+
examples = @ExampleObject(value = """
531+
{
532+
"success": false,
533+
"code": "POST_001",
534+
"message": "존재하지 않는 게시글입니다.",
535+
"data": null
536+
}
537+
""")
538+
)
539+
),
540+
@ApiResponse(
541+
responseCode = "500",
542+
description = "서버 내부 오류",
543+
content = @Content(
544+
mediaType = "application/json",
545+
examples = @ExampleObject(value = """
546+
{
547+
"success": false,
548+
"code": "COMMON_500",
549+
"message": "서버 오류가 발생했습니다.",
550+
"data": null
551+
}
552+
""")
553+
)
554+
)
555+
})
556+
ResponseEntity<RsData<Void>> deletePost(
557+
@PathVariable Long postId,
558+
@AuthenticationPrincipal CustomUserDetails user
559+
);
441560
}

0 commit comments

Comments
 (0)