Skip to content

Commit

Permalink
♻️ Swagger 전면 수정 (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jindongleee authored Nov 15, 2024
1 parent c201df3 commit fc6f704
Show file tree
Hide file tree
Showing 5 changed files with 176 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ public interface CreatorControllerApi {
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "크리에이터 등록 완료",
content = @Content(mediaType = "application/json",
examples = @ExampleObject(value = "{\n"
+ " \"timestamp\": \"2024-11-03T05:07:47.704694\",\n"
+ " \"isSuccess\": true,\n"
+ " \"code\": \"200\",\n"
+ " \"message\": \"호출에 성공하였습니다.\",\n"
+ " \"data\": \"null"
+ "}"),
examples = @ExampleObject(value = """
{
"timestamp": "2024-11-03T05:07:47.704694",
"isSuccess": true,
"code": "200",
"message": "호출에 성공하였습니다.",
"data": null
}
"""
),
schema = @Schema(implementation = SuccessResponse.class)))
})
@PostMapping
Expand All @@ -53,13 +56,35 @@ SuccessResponse<?> createCreator(
@ApiResponse(responseCode = "200",
description = "크리에이터 상세 페이지 조회 nickname = 크리에이터명",
content = @Content(mediaType = "application/json",
examples = @ExampleObject(value = "{\n"
+ " \"timestamp\": \"2024-11-03T05:07:47.704694\",\n"
+ " \"isSuccess\": true,\n"
+ " \"code\": \"200\",\n"
+ " \"message\": \"호출에 성공하였습니다.\",\n"
+ " \"data\": \"null"
+ "}"),
examples = @ExampleObject(value = """
{
"nickname": "USER8543",
"profileImgUrl": "https~~",
"introductionTitle": "내가 최고라서",
"introductionContent": "저한테 맡겨만 주세요",
"getPortfolioResList": [
{
"title": "제 첫번째 작품입니다.",
"thumbnailImgUrl": "https~",
"fileUrl": "https~"
},
{
"title": "제 두번째 작품입니다.",
"thumbnailImgUrl": "https~",
"fileUrl": "https~"
}
],
"getWorkResList": [
{
"title": "포토샵",
"period": 13,
"startPrice": 25000,
"category": "SNS"
}
],
"contactKakaoId": "jackcoke",
"contactEmail": "[email protected]"
}"""),
schema = @Schema(implementation = SuccessResponse.class)))
})
@GetMapping
Expand All @@ -71,23 +96,47 @@ SuccessResponse<?> createCreator(
description = "크리에이터 등록 초기화면 불러오기 즉 크리에이터 등록을 클릭 시"
+" 기존에 저장 되어 있던 크리에이터 정보 불러 온다.",
content = @Content(mediaType = "application/json",
examples = @ExampleObject(value = "{\n"
+ " \"timestamp\": \"2024-11-03T05:07:47.704694\",\n"
+ " \"isSuccess\": true,\n"
+ " \"code\": \"200\",\n"
+ " \"message\": \"호출에 성공하였습니다.\",\n"
+ " \"data\": \"null"
+ "}"),
examples = @ExampleObject(value = """
{
"nickname": "USER8543",
"profileImgUrl": "https~~",
"introductionTitle": "내가 최고라서",
"introductionContent": "저한테 맡겨만 주세요",
"getPortfolioResList": [
{
"title": "제 첫번째 작품입니다.",
"thumbnailImgUrl": "https~",
"fileUrl": "https~"
},
{
"title": "제 두번째 작품입니다.",
"thumbnailImgUrl": "https~",
"fileUrl": "https~"
}
],
"getWorkResList": [
{
"title": "포토샵",
"period": 13,
"startPrice": 25000,
"category": "SNS"
}
],
"contactKakaoId": "jackcoke",
"contactEmail": "[email protected]"
}"""),
schema = @Schema(implementation = SuccessResponse.class)))
})
@GetMapping
SuccessResponse<?> getCreatorInfo(Authentication authentication);

@Operation(summary = "크리에이터 찾기")
@ApiResponses(value = {
@ApiResponse(responseCode = "200",
@ApiResponse(
responseCode = "200",
description = "크리에이터 찾기에서 사용되는 API",
content = @Content(mediaType = "application/json",
content = @Content(
mediaType = "application/json",
examples = @ExampleObject(value = """
{
"timestamp": "2024-11-14T21:39:55.407616",
Expand Down Expand Up @@ -134,9 +183,11 @@ SuccessResponse<?> createCreator(
]
}
}
"""
"""
),
schema = @Schema(implementation = SuccessResponse.class)))
schema = @Schema(implementation = SuccessResponse.class)
)
)
})
@GetMapping
SuccessResponse<PageResponse<CreatorInfo>> filteringCreator(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.example.gather_back_end.creator.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import org.example.gather_back_end.domain.User;
import org.example.gather_back_end.portfolio.dto.CreatePortfolioReq;
Expand All @@ -10,12 +11,51 @@

@Builder
public record CreateCreatorReq(
@Schema(description = "사용자가 입력한 크리에이터명", example = "Hong티쳐")
String nickname,

@Schema(description = "사용자가 입력한 소개글 제목", example = "전부 다 합니다.")
String introductionTitle,

@Schema(description = "사용자가 입력한 소개글", example = "이것저것 한지 오래 됐어요")
String introductionContent,

@Schema(description = "카카오톡 아이디", example = "Legend")
String contactKaKaoId,

@Schema(description = "사용자 이메일", example = "[email protected]")
String contactEmail,

@Schema(description = "사용자 본인 포트폴리오",
example = """
[
{
"title": "이것도 합니다."
},
{
"title": "저것도 합니다"
}
]""")
List<CreatePortfolioReq> createPortfolioReqList,

@Schema(description = "사용자 작업 가능 항목",
example = """
[
{
"title": "다좋아",
"period": 13,
"startPrice": 25000,
"category": "PRINTS"
},
{
"title": "그냥 좋아",
"period": 52,
"startPrice": 245000,
"category": "PRINTS"
}
]
"""
)
List<CreateWorkReq> createWorkReqList
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,4 @@ public SuccessResponse<CustomOpenAiClientResponse> requestToOpenAi(
return SuccessResponse.of(response);
}

@PostMapping("/test2")
public String test(Authentication authentication,@RequestBody String test) {
if (authentication == null) {
return "null입니다.";
}
else {
return test;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,4 @@ public SuccessResponse<String> testException() {
throw new TestNotFoundException();
}

@GetMapping("/jwt-test")
public SuccessResponse<String> testJwt(Authentication authentication) {
if (authentication == null) {
return SuccessResponse.of("token is null");
}
else {
CustomOAuth2User customOAuth2User = (CustomOAuth2User) authentication.getPrincipal();
return SuccessResponse.of(customOAuth2User.getUsername());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,64 @@ public interface UserControllerApi {
})
@GetMapping
SuccessResponse<?> getUser(Authentication authentication);

@Operation(summary = "마이페이지 불러오기",
description = "마이페이지 불러오기, 토큰만 있으면 됩니다.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공",
content = @Content(mediaType = "application/json",
examples = @ExampleObject(value = """
{
"timestamp": "2024-11-16T00:51:05.668577",
"isSuccess": true,
"code": "200",
"message": "호출에 성공하였습니다.",
"data": {
"profileInfo": {
"profileImgUrl": null,
"role": "크리에이터",
"email": "[email protected]"
},
"promotionInfo": [
{
"createDay": "2024.11.12",
"title": "OOO 동아리 모집",
"period": 43,
"targetNumberOfPeople": 396,
"budget": 835000
},
{
"createDay": "2024.11.12",
"title": "OOO 동아리 모집",
"period": 43,
"targetNumberOfPeople": 396,
"budget": 835000
},
{
"createDay": "2024.11.13",
"title": "OOO 동아리 모집",
"period": 43,
"targetNumberOfPeople": 396,
"budget": 100000
}
],
"creatorInfo": [
{
"nickname": "USER3322",
"availableWork": [
"PRINTS",
"SNS_POST"
],
"introductionTitle": "dkssudd",
"startPrice": "500",
"thumbnailImgUrl": "https~"
}
]
}
}
"""),
schema = @Schema(implementation = SuccessResponse.class)))
})
@GetMapping
SuccessResponse<?> getMyPage(Authentication authentication);
}

0 comments on commit fc6f704

Please sign in to comment.