Skip to content

Commit baef50e

Browse files
committed
Docs: Swagger 문서 작성
1 parent 215721c commit baef50e

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed

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

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,119 @@ ResponseEntity<RsData<CommentResponse>> updateComment(
282282
@RequestBody CommentRequest request,
283283
@AuthenticationPrincipal CustomUserDetails user
284284
);
285+
286+
@Operation(
287+
summary = "댓글 삭제",
288+
description = "로그인한 사용자가 자신이 작성한 댓글을 삭제합니다."
289+
)
290+
@ApiResponses({
291+
@ApiResponse(
292+
responseCode = "200",
293+
description = "댓글 삭제 성공",
294+
content = @Content(
295+
mediaType = "application/json",
296+
examples = @ExampleObject(value = """
297+
{
298+
"success": true,
299+
"code": "SUCCESS_200",
300+
"message": "댓글이 삭제되었습니다.",
301+
"data": null
302+
}
303+
""")
304+
)
305+
),
306+
@ApiResponse(
307+
responseCode = "401",
308+
description = "인증 실패 (토큰 없음/잘못됨/만료)",
309+
content = @Content(
310+
mediaType = "application/json",
311+
examples = {
312+
@ExampleObject(name = "토큰 없음", value = """
313+
{
314+
"success": false,
315+
"code": "AUTH_001",
316+
"message": "인증이 필요합니다.",
317+
"data": null
318+
}
319+
"""),
320+
@ExampleObject(name = "잘못된 토큰", value = """
321+
{
322+
"success": false,
323+
"code": "AUTH_002",
324+
"message": "유효하지 않은 액세스 토큰입니다.",
325+
"data": null
326+
}
327+
"""),
328+
@ExampleObject(name = "만료된 토큰", value = """
329+
{
330+
"success": false,
331+
"code": "AUTH_004",
332+
"message": "만료된 액세스 토큰입니다.",
333+
"data": null
334+
}
335+
""")
336+
}
337+
)
338+
),
339+
@ApiResponse(
340+
responseCode = "403",
341+
description = "권한 없음 (작성자 아님)",
342+
content = @Content(
343+
mediaType = "application/json",
344+
examples = @ExampleObject(value = """
345+
{
346+
"success": false,
347+
"code": "COMMENT_002",
348+
"message": "댓글 작성자만 수정/삭제할 수 있습니다.",
349+
"data": null
350+
}
351+
""")
352+
)
353+
),
354+
@ApiResponse(
355+
responseCode = "404",
356+
description = "존재하지 않는 게시글 또는 댓글",
357+
content = @Content(
358+
mediaType = "application/json",
359+
examples = {
360+
@ExampleObject(name = "존재하지 않는 게시글", value = """
361+
{
362+
"success": false,
363+
"code": "POST_001",
364+
"message": "존재하지 않는 게시글입니다.",
365+
"data": null
366+
}
367+
"""),
368+
@ExampleObject(name = "존재하지 않는 댓글", value = """
369+
{
370+
"success": false,
371+
"code": "COMMENT_001",
372+
"message": "존재하지 않는 댓글입니다.",
373+
"data": null
374+
}
375+
""")
376+
}
377+
)
378+
),
379+
@ApiResponse(
380+
responseCode = "500",
381+
description = "서버 내부 오류",
382+
content = @Content(
383+
mediaType = "application/json",
384+
examples = @ExampleObject(value = """
385+
{
386+
"success": false,
387+
"code": "COMMON_500",
388+
"message": "서버 오류가 발생했습니다.",
389+
"data": null
390+
}
391+
""")
392+
)
393+
)
394+
})
395+
ResponseEntity<RsData<Void>> deleteComment(
396+
@PathVariable Long postId,
397+
@PathVariable Long commentId,
398+
@AuthenticationPrincipal CustomUserDetails user
399+
);
285400
}

0 commit comments

Comments
 (0)