33import com .back .domain .board .comment .dto .CommentListResponse ;
44import com .back .domain .board .comment .dto .CommentRequest ;
55import com .back .domain .board .comment .dto .CommentResponse ;
6+ import com .back .domain .board .comment .dto .ReplyResponse ;
67import com .back .domain .board .common .dto .PageResponse ;
78import com .back .global .common .dto .RsData ;
89import com .back .global .security .user .CustomUserDetails ;
@@ -509,4 +510,157 @@ ResponseEntity<RsData<Void>> deleteComment(
509510 @ PathVariable Long commentId ,
510511 @ AuthenticationPrincipal CustomUserDetails user
511512 );
513+
514+ @ Operation (
515+ summary = "대댓글 생성" ,
516+ description = "로그인한 사용자가 특정 게시글의 댓글에 대댓글을 작성합니다. (대댓글은 1단계까지만 허용됩니다.)"
517+ )
518+ @ ApiResponses ({
519+ @ ApiResponse (
520+ responseCode = "201" ,
521+ description = "대댓글 생성 성공" ,
522+ content = @ Content (
523+ mediaType = "application/json" ,
524+ examples = @ ExampleObject (value = """
525+ {
526+ "success": true,
527+ "code": "SUCCESS_200",
528+ "message": "대댓글이 생성되었습니다.",
529+ "data": {
530+ "replyId": 45,
531+ "postId": 101,
532+ "parentId": 25,
533+ "author": {
534+ "id": 7,
535+ "nickname": "이몽룡"
536+ },
537+ "content": "저도 동의합니다!",
538+ "createdAt": "2025-09-22T13:30:00",
539+ "updatedAt": "2025-09-22T13:30:00"
540+ }
541+ }
542+ """ )
543+ )
544+ ),
545+ @ ApiResponse (
546+ responseCode = "400" ,
547+ description = "잘못된 요청 또는 depth 제한 초과" ,
548+ content = @ Content (
549+ mediaType = "application/json" ,
550+ examples = {
551+ @ ExampleObject (name = "필드 누락" , value = """
552+ {
553+ "success": false,
554+ "code": "COMMON_400",
555+ "message": "잘못된 요청입니다.",
556+ "data": null
557+ }
558+ """ ),
559+ @ ExampleObject (name = "부모 댓글 불일치" , value = """
560+ {
561+ "success": false,
562+ "code": "COMMENT_003",
563+ "message": "부모 댓글이 해당 게시글에 속하지 않습니다.",
564+ "data": null
565+ }
566+ """ ),
567+ @ ExampleObject (name = "depth 초과" , value = """
568+ {
569+ "success": false,
570+ "code": "COMMENT_004",
571+ "message": "대댓글은 한 단계까지만 작성할 수 있습니다.",
572+ "data": null
573+ }
574+ """ )
575+ }
576+ )
577+ ),
578+ @ ApiResponse (
579+ responseCode = "401" ,
580+ description = "인증 실패 (토큰 없음/잘못됨/만료)" ,
581+ content = @ Content (
582+ mediaType = "application/json" ,
583+ examples = {
584+ @ ExampleObject (name = "토큰 없음" , value = """
585+ {
586+ "success": false,
587+ "code": "AUTH_001",
588+ "message": "인증이 필요합니다.",
589+ "data": null
590+ }
591+ """ ),
592+ @ ExampleObject (name = "잘못된 토큰" , value = """
593+ {
594+ "success": false,
595+ "code": "AUTH_002",
596+ "message": "유효하지 않은 액세스 토큰입니다.",
597+ "data": null
598+ }
599+ """ ),
600+ @ ExampleObject (name = "만료된 토큰" , value = """
601+ {
602+ "success": false,
603+ "code": "AUTH_004",
604+ "message": "만료된 액세스 토큰입니다.",
605+ "data": null
606+ }
607+ """ )
608+ }
609+ )
610+ ),
611+ @ ApiResponse (
612+ responseCode = "404" ,
613+ description = "존재하지 않는 사용자 / 게시글 / 댓글" ,
614+ content = @ Content (
615+ mediaType = "application/json" ,
616+ examples = {
617+ @ ExampleObject (name = "존재하지 않는 사용자" , value = """
618+ {
619+ "success": false,
620+ "code": "USER_001",
621+ "message": "존재하지 않는 사용자입니다.",
622+ "data": null
623+ }
624+ """ ),
625+ @ ExampleObject (name = "존재하지 않는 게시글" , value = """
626+ {
627+ "success": false,
628+ "code": "POST_001",
629+ "message": "존재하지 않는 게시글입니다.",
630+ "data": null
631+ }
632+ """ ),
633+ @ ExampleObject (name = "존재하지 않는 댓글" , value = """
634+ {
635+ "success": false,
636+ "code": "COMMENT_001",
637+ "message": "존재하지 않는 댓글입니다.",
638+ "data": null
639+ }
640+ """ )
641+ }
642+ )
643+ ),
644+ @ ApiResponse (
645+ responseCode = "500" ,
646+ description = "서버 내부 오류" ,
647+ content = @ Content (
648+ mediaType = "application/json" ,
649+ examples = @ ExampleObject (value = """
650+ {
651+ "success": false,
652+ "code": "COMMON_500",
653+ "message": "서버 오류가 발생했습니다.",
654+ "data": null
655+ }
656+ """ )
657+ )
658+ )
659+ })
660+ ResponseEntity <RsData <ReplyResponse >> createReply (
661+ @ PathVariable Long postId ,
662+ @ PathVariable Long commentId ,
663+ @ RequestBody CommentRequest request ,
664+ @ AuthenticationPrincipal CustomUserDetails user
665+ );
512666}
0 commit comments