Skip to content

Commit 3e95188

Browse files
committed
Docs: Swagger 문서 작성
1 parent d93d130 commit 3e95188

File tree

1 file changed

+169
-0
lines changed

1 file changed

+169
-0
lines changed

src/main/java/com/back/domain/user/controller/UserControllerDocs.java

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.back.domain.user.controller;
22

3+
import com.back.domain.board.comment.dto.MyCommentResponse;
34
import com.back.domain.board.common.dto.PageResponse;
45
import com.back.domain.board.post.dto.PostListResponse;
56
import com.back.domain.user.dto.ChangePasswordRequest;
@@ -757,4 +758,172 @@ ResponseEntity<RsData<PageResponse<PostListResponse>>> getMyPosts(
757758
@AuthenticationPrincipal CustomUserDetails user,
758759
@ParameterObject Pageable pageable
759760
);
761+
762+
@Operation(
763+
summary = "내 댓글 목록 조회",
764+
description = """
765+
로그인한 사용자가 작성한 댓글 목록을 조회합니다.
766+
- 기본 정렬: createdAt,desc
767+
- 페이지 및 정렬 조건은 Query Parameter로 조정 가능합니다.
768+
"""
769+
)
770+
@ApiResponses({
771+
@ApiResponse(
772+
responseCode = "200",
773+
description = "내 댓글 목록 조회 성공",
774+
content = @Content(
775+
mediaType = "application/json",
776+
examples = @ExampleObject(value = """
777+
{
778+
"success": true,
779+
"code": "SUCCESS_200",
780+
"message": "내 댓글 목록이 조회되었습니다.",
781+
"data": {
782+
"items": [
783+
{
784+
"commentId": 12,
785+
"postId": 5,
786+
"postTitle": "스프링 트랜잭션 정리",
787+
"parentId": null,
788+
"parentContent": null,
789+
"content": "정말 도움이 많이 됐어요!",
790+
"likeCount": 3,
791+
"createdAt": "2025-09-29T12:15:00",
792+
"updatedAt": "2025-09-29T12:30:00"
793+
},
794+
{
795+
"commentId": 14,
796+
"postId": 5,
797+
"postTitle": "스프링 트랜잭션 정리",
798+
"parentId": 13,
799+
"parentContent": "코딩 박사의 스프링 교재도 추천합니다.",
800+
"content": "감사합니다! 더 공부해볼게요.",
801+
"likeCount": 1,
802+
"createdAt": "2025-09-29T12:45:00",
803+
"updatedAt": "2025-09-29T12:45:00"
804+
}
805+
],
806+
"page": 0,
807+
"size": 10,
808+
"totalElements": 2,
809+
"totalPages": 1,
810+
"last": true
811+
}
812+
}
813+
""")
814+
)
815+
),
816+
@ApiResponse(
817+
responseCode = "404",
818+
description = "존재하지 않는 사용자",
819+
content = @Content(
820+
mediaType = "application/json",
821+
examples = @ExampleObject(value = """
822+
{
823+
"success": false,
824+
"code": "USER_001",
825+
"message": "존재하지 않는 사용자입니다.",
826+
"data": null
827+
}
828+
""")
829+
)
830+
),
831+
@ApiResponse(
832+
responseCode = "410",
833+
description = "탈퇴한 계정",
834+
content = @Content(
835+
mediaType = "application/json",
836+
examples = @ExampleObject(value = """
837+
{
838+
"success": false,
839+
"code": "USER_009",
840+
"message": "탈퇴한 계정입니다.",
841+
"data": null
842+
}
843+
""")
844+
)
845+
),
846+
@ApiResponse(
847+
responseCode = "403",
848+
description = "정지된 계정",
849+
content = @Content(
850+
mediaType = "application/json",
851+
examples = @ExampleObject(value = """
852+
{
853+
"success": false,
854+
"code": "USER_008",
855+
"message": "정지된 계정입니다. 관리자에게 문의하세요.",
856+
"data": null
857+
}
858+
""")
859+
)
860+
),
861+
@ApiResponse(
862+
responseCode = "401",
863+
description = "인증 실패 (토큰 없음/잘못됨/만료)",
864+
content = @Content(
865+
mediaType = "application/json",
866+
examples = {
867+
@ExampleObject(name = "토큰 없음", value = """
868+
{
869+
"success": false,
870+
"code": "AUTH_001",
871+
"message": "인증이 필요합니다.",
872+
"data": null
873+
}
874+
"""),
875+
@ExampleObject(name = "잘못된 토큰", value = """
876+
{
877+
"success": false,
878+
"code": "AUTH_002",
879+
"message": "유효하지 않은 액세스 토큰입니다.",
880+
"data": null
881+
}
882+
"""),
883+
@ExampleObject(name = "만료된 토큰", value = """
884+
{
885+
"success": false,
886+
"code": "AUTH_004",
887+
"message": "만료된 액세스 토큰입니다.",
888+
"data": null
889+
}
890+
""")
891+
}
892+
)
893+
),
894+
@ApiResponse(
895+
responseCode = "400",
896+
description = "잘못된 요청(파라미터 오류)",
897+
content = @Content(
898+
mediaType = "application/json",
899+
examples = @ExampleObject(value = """
900+
{
901+
"success": false,
902+
"code": "COMMON_400",
903+
"message": "잘못된 요청입니다.",
904+
"data": null
905+
}
906+
""")
907+
)
908+
),
909+
@ApiResponse(
910+
responseCode = "500",
911+
description = "서버 내부 오류",
912+
content = @Content(
913+
mediaType = "application/json",
914+
examples = @ExampleObject(value = """
915+
{
916+
"success": false,
917+
"code": "COMMON_500",
918+
"message": "서버 오류가 발생했습니다.",
919+
"data": null
920+
}
921+
""")
922+
)
923+
)
924+
})
925+
ResponseEntity<RsData<PageResponse<MyCommentResponse>>> getMyComments(
926+
@AuthenticationPrincipal CustomUserDetails user,
927+
@ParameterObject Pageable pageable
928+
);
760929
}

0 commit comments

Comments
 (0)