Skip to content

Commit 94976df

Browse files
committed
Docs: Swagger 문서 작성
1 parent 0a2ab8a commit 94976df

File tree

1 file changed

+172
-0
lines changed

1 file changed

+172
-0
lines changed

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

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,4 +926,176 @@ ResponseEntity<RsData<PageResponse<MyCommentResponse>>> getMyComments(
926926
@AuthenticationPrincipal CustomUserDetails user,
927927
@ParameterObject Pageable pageable
928928
);
929+
930+
@Operation(
931+
summary = "내 북마크 게시글 목록 조회",
932+
description = """
933+
로그인한 사용자가 북마크한 게시글 목록을 조회합니다.
934+
- 기본 정렬: createdAt,desc
935+
- 페이지 및 정렬 조건은 Query Parameter로 조정 가능합니다.
936+
"""
937+
)
938+
@ApiResponses({
939+
@ApiResponse(
940+
responseCode = "200",
941+
description = "내 북마크 게시글 목록 조회 성공",
942+
content = @Content(
943+
mediaType = "application/json",
944+
examples = @ExampleObject(value = """
945+
{
946+
"success": true,
947+
"code": "SUCCESS_200",
948+
"message": "내 북마크 게시글 목록이 조회되었습니다.",
949+
"data": {
950+
"items": [
951+
{
952+
"postId": 22,
953+
"author": { "id": 3, "nickname": "홍길동", "profileImageUrl": null },
954+
"title": "JPA 영속성 전이 완벽 정리",
955+
"thumbnailUrl": "https://cdn.example.com/thumbnails/jpa.png",
956+
"categories": [
957+
{ "id": 2, "name": "백엔드", "type": "SUBJECT" }
958+
],
959+
"likeCount": 12,
960+
"bookmarkCount": 7,
961+
"commentCount": 3,
962+
"createdAt": "2025-09-28T11:20:00",
963+
"updatedAt": "2025-09-28T12:00:00"
964+
},
965+
{
966+
"postId": 10,
967+
"author": { "id": 7, "nickname": "이자바", "profileImageUrl": null },
968+
"title": "테스트 코드 작성 가이드",
969+
"thumbnailUrl": null,
970+
"categories": [],
971+
"likeCount": 2,
972+
"bookmarkCount": 1,
973+
"commentCount": 0,
974+
"createdAt": "2025-09-25T09:10:00",
975+
"updatedAt": "2025-09-25T09:10:00"
976+
}
977+
],
978+
"page": 0,
979+
"size": 10,
980+
"totalElements": 2,
981+
"totalPages": 1,
982+
"last": true
983+
}
984+
}
985+
""")
986+
)
987+
),
988+
@ApiResponse(
989+
responseCode = "404",
990+
description = "존재하지 않는 사용자",
991+
content = @Content(
992+
mediaType = "application/json",
993+
examples = @ExampleObject(value = """
994+
{
995+
"success": false,
996+
"code": "USER_001",
997+
"message": "존재하지 않는 사용자입니다.",
998+
"data": null
999+
}
1000+
""")
1001+
)
1002+
),
1003+
@ApiResponse(
1004+
responseCode = "410",
1005+
description = "탈퇴한 계정",
1006+
content = @Content(
1007+
mediaType = "application/json",
1008+
examples = @ExampleObject(value = """
1009+
{
1010+
"success": false,
1011+
"code": "USER_009",
1012+
"message": "탈퇴한 계정입니다.",
1013+
"data": null
1014+
}
1015+
""")
1016+
)
1017+
),
1018+
@ApiResponse(
1019+
responseCode = "403",
1020+
description = "정지된 계정",
1021+
content = @Content(
1022+
mediaType = "application/json",
1023+
examples = @ExampleObject(value = """
1024+
{
1025+
"success": false,
1026+
"code": "USER_008",
1027+
"message": "정지된 계정입니다. 관리자에게 문의하세요.",
1028+
"data": null
1029+
}
1030+
""")
1031+
)
1032+
),
1033+
@ApiResponse(
1034+
responseCode = "401",
1035+
description = "인증 실패 (토큰 없음/잘못됨/만료)",
1036+
content = @Content(
1037+
mediaType = "application/json",
1038+
examples = {
1039+
@ExampleObject(name = "토큰 없음", value = """
1040+
{
1041+
"success": false,
1042+
"code": "AUTH_001",
1043+
"message": "인증이 필요합니다.",
1044+
"data": null
1045+
}
1046+
"""),
1047+
@ExampleObject(name = "잘못된 토큰", value = """
1048+
{
1049+
"success": false,
1050+
"code": "AUTH_002",
1051+
"message": "유효하지 않은 액세스 토큰입니다.",
1052+
"data": null
1053+
}
1054+
"""),
1055+
@ExampleObject(name = "만료된 토큰", value = """
1056+
{
1057+
"success": false,
1058+
"code": "AUTH_004",
1059+
"message": "만료된 액세스 토큰입니다.",
1060+
"data": null
1061+
}
1062+
""")
1063+
}
1064+
)
1065+
),
1066+
@ApiResponse(
1067+
responseCode = "400",
1068+
description = "잘못된 요청(파라미터 오류)",
1069+
content = @Content(
1070+
mediaType = "application/json",
1071+
examples = @ExampleObject(value = """
1072+
{
1073+
"success": false,
1074+
"code": "COMMON_400",
1075+
"message": "잘못된 요청입니다.",
1076+
"data": null
1077+
}
1078+
""")
1079+
)
1080+
),
1081+
@ApiResponse(
1082+
responseCode = "500",
1083+
description = "서버 내부 오류",
1084+
content = @Content(
1085+
mediaType = "application/json",
1086+
examples = @ExampleObject(value = """
1087+
{
1088+
"success": false,
1089+
"code": "COMMON_500",
1090+
"message": "서버 오류가 발생했습니다.",
1091+
"data": null
1092+
}
1093+
""")
1094+
)
1095+
)
1096+
})
1097+
ResponseEntity<RsData<PageResponse<PostListResponse>>> getMyBookmarks(
1098+
@AuthenticationPrincipal CustomUserDetails user,
1099+
@ParameterObject Pageable pageable
1100+
);
9291101
}

0 commit comments

Comments
 (0)