From b7ecb6e33eefcb71d06423fb6dcd1328bcb8fdcd Mon Sep 17 00:00:00 2001 From: jusung-c Date: Wed, 15 Nov 2023 21:28:09 +0900 Subject: [PATCH] =?UTF-8?q?chore(#111):=20API=20Response=20Example=20value?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../heachi/auth/api/controller/auth/AuthController.java | 8 ++++++++ .../api/controller/group/info/GroupInfoController.java | 7 +++++++ .../controller/group/member/GroupMemberController.java | 5 +++++ .../housework/category/HouseworkCategoryController.java | 6 ++++++ .../api/controller/housework/todo/TodoController.java | 7 +++++++ 5 files changed, 33 insertions(+) diff --git a/heachi-core/auth-api/src/main/java/com/heachi/auth/api/controller/auth/AuthController.java b/heachi-core/auth-api/src/main/java/com/heachi/auth/api/controller/auth/AuthController.java index aefc698e..591a4fdf 100644 --- a/heachi-core/auth-api/src/main/java/com/heachi/auth/api/controller/auth/AuthController.java +++ b/heachi-core/auth-api/src/main/java/com/heachi/auth/api/controller/auth/AuthController.java @@ -13,6 +13,10 @@ import com.heachi.auth.api.service.state.LoginStateService; import com.heachi.mysql.define.user.User; import com.heachi.mysql.define.user.constant.UserPlatformType; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -40,6 +44,7 @@ public JsonResult loginPage( return JsonResult.successOf(loginPage); } + @ApiResponse(responseCode = "200", description = "로그인 성공", content = @Content(schema = @Schema(implementation = AuthServiceLoginResponse.class))) @GetMapping("/{platformType}/login") public JsonResult login( @PathVariable("platformType") UserPlatformType platformType, @@ -53,6 +58,7 @@ public JsonResult login( return JsonResult.successOf(loginResponse); } + @ApiResponse(responseCode = "200", description = "회원가입 성공", content = @Content(schema = @Schema(implementation = AuthServiceLoginResponse.class))) @PostMapping("/register") public JsonResult register( @Valid @RequestBody AuthRegisterRequest request) { @@ -62,6 +68,7 @@ public JsonResult register( return JsonResult.successOf(registerResponse); } + @ApiResponse(responseCode = "200", description = "회원 정보 불러오기 성공", content = @Content(schema = @Schema(implementation = UserSimpleInfoResponse.class))) @GetMapping("/info") public JsonResult userInfo(@AuthenticationPrincipal User user) { @@ -90,6 +97,7 @@ public JsonResult userDelete(@AuthenticationPrincipal User user) { return JsonResult.successOf(); } + @ApiResponse(responseCode = "200", description = "토큰 재발급 성공", content = @Content(schema = @Schema(implementation = ReissueAccessTokenResponse.class))) @PostMapping("/reissue") public JsonResult reissueAccessToken(@RequestHeader(name = "Authorization") String token) { List tokens = Arrays.asList(token.split(" ")); diff --git a/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/group/info/GroupInfoController.java b/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/group/info/GroupInfoController.java index 7a886577..8e69dde8 100644 --- a/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/group/info/GroupInfoController.java +++ b/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/group/info/GroupInfoController.java @@ -5,6 +5,10 @@ import com.heachi.housework.api.controller.group.info.request.GroupInfoRegisterRequest; import com.heachi.housework.api.service.auth.AuthExternalService; import com.heachi.housework.api.service.group.info.GroupInfoService; +import com.heachi.housework.api.service.group.info.response.GroupInfoUserGroupServiceResponse; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; @@ -19,6 +23,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; +import java.util.List; + @Slf4j @RestController @RequiredArgsConstructor @@ -47,6 +53,7 @@ public JsonResult createGroupInfo(@RequestHeader(name = "Authorization") Stri } // User가 가입한 Group 정보를 리턴한다. + @ApiResponse(responseCode = "200", description = "그룹 리스트 조회 성공", content = @Content(schema = @Schema(implementation = GroupInfoUserGroupServiceResponse.class, type = "array"))) @GetMapping("/list") public JsonResult userGroupInfoList(@RequestHeader(name = "Authorization") String authorization) { UserInfoResponse userInfo = authExternalService.userAuthenticate(authorization); diff --git a/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/group/member/GroupMemberController.java b/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/group/member/GroupMemberController.java index f67a5868..03d88db7 100644 --- a/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/group/member/GroupMemberController.java +++ b/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/group/member/GroupMemberController.java @@ -4,6 +4,10 @@ import com.heachi.housework.api.controller.group.member.response.GroupMemberResponse; import com.heachi.housework.api.service.auth.AuthExternalService; import com.heachi.housework.api.service.group.member.GroupMemberService; +import com.heachi.redis.define.housework.todo.TodoList; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; @@ -18,6 +22,7 @@ public class GroupMemberController { private final AuthExternalService authExternalService; private final GroupMemberService groupMemberService; + @ApiResponse(responseCode = "200", description = "Group Member 리스트 조회 성공", content = @Content(schema = @Schema(implementation = GroupMemberResponse.class, type = "array"))) @GetMapping("/{groupId}") public JsonResult groupMemberList(@RequestHeader(name = "Authorization") String authorization, @PathVariable(name = "groupId") Long groupId) { diff --git a/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/housework/category/HouseworkCategoryController.java b/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/housework/category/HouseworkCategoryController.java index 9252cead..dffe6824 100644 --- a/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/housework/category/HouseworkCategoryController.java +++ b/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/housework/category/HouseworkCategoryController.java @@ -1,7 +1,12 @@ package com.heachi.housework.api.controller.housework.category; import com.heachi.admin.common.response.JsonResult; +import com.heachi.housework.api.controller.group.member.response.GroupMemberResponse; import com.heachi.housework.api.service.housework.category.HouseworkCategoryService; +import com.heachi.housework.api.service.housework.category.response.HouseworkCategoryResponse; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; @@ -16,6 +21,7 @@ public class HouseworkCategoryController { private final HouseworkCategoryService houseworkCategoryService; + @ApiResponse(responseCode = "200", description = "카테고리 리스트 조회 성공", content = @Content(schema = @Schema(implementation = HouseworkCategoryResponse.class, type = "array"))) @GetMapping("/") public JsonResult selectCategory() { diff --git a/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/housework/todo/TodoController.java b/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/housework/todo/TodoController.java index c3127e64..ec736e3f 100644 --- a/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/housework/todo/TodoController.java +++ b/heachi-core/housework-api/src/main/java/com/heachi/housework/api/controller/housework/todo/TodoController.java @@ -4,10 +4,16 @@ import com.heachi.external.clients.auth.response.UserInfoResponse; import com.heachi.housework.api.controller.housework.todo.request.VerifyTodoRequest; import com.heachi.housework.api.service.auth.AuthExternalService; +import com.heachi.housework.api.service.group.info.response.GroupInfoUserGroupServiceResponse; import com.heachi.housework.api.service.housework.todo.TodoService; import com.heachi.housework.api.service.housework.todo.request.TodoSelectRequest; import com.heachi.housework.api.service.housework.todo.request.VerifyTodoServiceRequest; +import com.heachi.redis.define.housework.todo.TodoList; import com.heachi.s3.api.service.AwsS3Service; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -26,6 +32,7 @@ public class TodoController { private final AwsS3Service awsS3Service; // Todo List 가져오기 + @ApiResponse(responseCode = "200", description = "Todo List 조회 성공", content = @Content(schema = @Schema(implementation = TodoList.class))) @GetMapping("/{groupId}") public JsonResult selectTodo(@RequestHeader(name = "Authorization") String authorization, @PathVariable(name = "groupId") Long groupId,