From 0f496c7159d0c870d7d4bd09dae5db5c265e923c Mon Sep 17 00:00:00 2001 From: ohu-star Date: Mon, 19 Aug 2024 22:13:54 +0900 Subject: [PATCH] =?UTF-8?q?[STYLE]=20swagger=EC=97=90=20monthBudget=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20api=20response=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/MonthBudgetController.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/main/java/umc/haruchi/web/controller/MonthBudgetController.java b/src/main/java/umc/haruchi/web/controller/MonthBudgetController.java index 480c20e..c53b0a5 100644 --- a/src/main/java/umc/haruchi/web/controller/MonthBudgetController.java +++ b/src/main/java/umc/haruchi/web/controller/MonthBudgetController.java @@ -1,6 +1,9 @@ package umc.haruchi.web.controller; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.security.core.annotation.AuthenticationPrincipal; @@ -27,6 +30,11 @@ public class MonthBudgetController { //한달 예산 수정 @Operation(summary = "한달 예산 수정 API", description = "본인의 한달 예산을 수정하는 API 입니다.") @PatchMapping("/") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200",description = "OK, 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MEMBER4005", description = "존재하지 않는 회원입니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MONTHBUDGET4001", description = "한 달 예산이 존재하지 않습니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + }) public ApiResponse updateMonthBudget(@AuthenticationPrincipal MemberDetail memberDetail, @RequestBody @Valid MonthBudgetRequestDTO.UpdateMonthDTO request) { MonthBudget monthBudget = monthBudgetService.updateMonthBudget(memberDetail.getMember().getId(), request); return ApiResponse.onSuccess(MonthBudgetConverter.toUpdateMonthResultDTO(monthBudget)); @@ -35,6 +43,11 @@ public ApiResponse updateMonthBudge //한달 예산 금액 조회 @Operation(summary = "한달 예산 금액 조회 API", description = "본인의 한달 예산 금액을 조회하는 API 입니다.") @GetMapping("/") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200",description = "OK, 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MEMBER4005", description = "존재하지 않는 회원입니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MONTHBUDGET4001", description = "한 달 예산이 존재하지 않습니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + }) public ApiResponse getMonthBudget(@AuthenticationPrincipal MemberDetail memberDetail) { MonthBudget monthBudget = monthBudgetService.getMonthBudget(memberDetail.getMember().getId()); return ApiResponse.onSuccess(MonthBudgetConverter.toGetMonthResultDTO(monthBudget)); @@ -43,6 +56,11 @@ public ApiResponse getMonthBudget(@Aut //한달 지출률 조회 @Operation(summary = "한달 지출률 조회 API", description = "본인의 한달 지출률을 조회하는 API") @GetMapping("/percent") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200",description = "OK, 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MEMBER4005", description = "존재하지 않는 회원입니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MONTHBUDGET4001", description = "한 달 예산이 존재하지 않습니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + }) public ApiResponse getMonthBudgetPercent(@AuthenticationPrincipal MemberDetail memberDetail) { double monthBudgetPercent = monthBudgetService.getMonthUsedPercent(memberDetail.getMember().getId()); return ApiResponse.onSuccess(MonthBudgetConverter.toGetMonthUsedPercentResultDTO(monthBudgetPercent)); @@ -51,6 +69,12 @@ public ApiResponse getMonth //한 주 예산 금액 조회 @Operation(summary = "한 주 예산 금액 조회 API", description = "본인의 한 주 예산 금액을 조회하는 API 입니다.") @GetMapping("/week") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200",description = "OK, 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MEMBER4005", description = "존재하지 않는 회원입니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MONTHBUDGET4001", description = "한 달 예산이 존재하지 않습니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "DAYBUDGET4002", description = "특정 날짜의 예산이 존재하지 않습니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + }) public ApiResponse getWeekBudget(@AuthenticationPrincipal MemberDetail memberDetail) { List weekBudget = monthBudgetService.getWeekBudget(memberDetail.getMember().getId()); List currentWeek = monthBudgetService.getMonthAndWeek(memberDetail.getMember().getId()); @@ -60,6 +84,11 @@ public ApiResponse getWeekBud //남은 일정 및 금액 조회 @Operation(summary = "남은 일정 및 금액 조회 API", description = "본인의 남은 한달 일정 및 금액을 조회하는 API") @GetMapping("/left-now") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200",description = "OK, 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MEMBER4005", description = "존재하지 않는 회원입니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "MONTHBUDGET4001", description = "한 달 예산이 존재하지 않습니다.",content = @Content(schema = @Schema(implementation = ApiResponse.class))), + }) public ApiResponse getMonthLeftNow(@AuthenticationPrincipal MemberDetail memberDetail) { Integer leftDay = monthBudgetService.getMonthLeftDay(memberDetail.getMember().getId()); Long leftBudget = monthBudgetService.getMonthLeftBudget(memberDetail.getMember().getId());