Skip to content

Commit

Permalink
Merge pull request #112 from ghdcksgml1/chore(#111)-swagger-config-ex…
Browse files Browse the repository at this point in the history
…ample-data

chore(#111): API Response Example value 추가
  • Loading branch information
ghdcksgml1 authored Nov 15, 2023
2 parents ca673a5 + b7ecb6e commit 320ddea
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -40,6 +44,7 @@ public JsonResult<String> loginPage(
return JsonResult.successOf(loginPage);
}

@ApiResponse(responseCode = "200", description = "로그인 성공", content = @Content(schema = @Schema(implementation = AuthServiceLoginResponse.class)))
@GetMapping("/{platformType}/login")
public JsonResult<String> login(
@PathVariable("platformType") UserPlatformType platformType,
Expand All @@ -53,6 +58,7 @@ public JsonResult<String> 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) {
Expand All @@ -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<UserSimpleInfoResponse> userInfo(@AuthenticationPrincipal User user) {

Expand Down Expand Up @@ -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<String> tokens = Arrays.asList(token.split(" "));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,6 +23,8 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequiredArgsConstructor
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down

0 comments on commit 320ddea

Please sign in to comment.