From 9b83ee5e59962ff37485f32a73b67ac4df068112 Mon Sep 17 00:00:00 2001 From: JaeSeo Yang <96044622+psychology50@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:56:12 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20=EC=A7=80=EC=B6=9C=20=EB=82=B4=EC=97=AD?= =?UTF-8?q?=20=EC=83=81=EC=84=B8=20=EC=A1=B0=ED=9A=8C=20=EC=98=88=EC=99=B8?= =?UTF-8?q?=EC=97=90=20api=5Fresponse=5Fexplanations=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/apis/ledger/api/SpendingApi.java | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/pennyway-app-external-api/src/main/java/kr/co/pennyway/api/apis/ledger/api/SpendingApi.java b/pennyway-app-external-api/src/main/java/kr/co/pennyway/api/apis/ledger/api/SpendingApi.java index ec81cb6e2..c0ba48b1e 100644 --- a/pennyway-app-external-api/src/main/java/kr/co/pennyway/api/apis/ledger/api/SpendingApi.java +++ b/pennyway-app-external-api/src/main/java/kr/co/pennyway/api/apis/ledger/api/SpendingApi.java @@ -14,7 +14,10 @@ import kr.co.pennyway.api.apis.ledger.dto.SpendingIdsDto; import kr.co.pennyway.api.apis.ledger.dto.SpendingReq; import kr.co.pennyway.api.apis.ledger.dto.SpendingSearchRes; +import kr.co.pennyway.api.common.annotation.ApiExceptionExplanation; +import kr.co.pennyway.api.common.annotation.ApiResponseExplanations; import kr.co.pennyway.api.common.security.authentication.SecurityUserDetails; +import kr.co.pennyway.domain.domains.spending.exception.SpendingErrorCode; import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.validation.annotation.Validated; @@ -64,19 +67,12 @@ public interface SpendingApi { @Operation(summary = "지출 내역 상세 조회", method = "GET", description = "지출 내역의 ID값으로 해당 지출의 상세 내역을 반환합니다.") @Parameter(name = "spendingId", description = "지출 내역 ID", example = "1", required = true, in = ParameterIn.PATH) - @ApiResponses({ - @ApiResponse(responseCode = "200", content = @Content(schemaProperties = @SchemaProperty(name = "spending", schema = @Schema(implementation = SpendingSearchRes.Individual.class)))), - @ApiResponse(responseCode = "404", description = "NOT_FOUND", content = @Content(examples = { - @ExampleObject(name = "지출 내역 조회 오류", - value = """ - { - "code": "4040", - "message": "존재하지 않는 지출 내역입니다." - } - """ - ) - })) - }) + @ApiResponse(responseCode = "200", content = @Content(schemaProperties = @SchemaProperty(name = "spending", schema = @Schema(implementation = SpendingSearchRes.Individual.class)))) + @ApiResponseExplanations( + errors = { + @ApiExceptionExplanation(name = "지출 내역 조회 오류", description = "NOT_FOUND", value = SpendingErrorCode.class, constant = "NOT_FOUND_SPENDING") + } + ) ResponseEntity getSpendingDetail(@PathVariable Long spendingId, @AuthenticationPrincipal SecurityUserDetails user); @Operation(summary = "지출 내역 수정", method = "PUT", description = """ @@ -101,7 +97,6 @@ public interface SpendingApi { })) ResponseEntity deleteSpending(@PathVariable Long spendingId, @AuthenticationPrincipal SecurityUserDetails user); - @Operation(summary = "지출 내역 복수 삭제", method = "DELETE", description = "사용자의 지출 내역의 ID목록으로 해당 지출 내역들을 삭제 합니다.") @ApiResponse(responseCode = "403", description = "지출 내역에 대한 권한이 없습니다.", content = @Content(examples = { @ExampleObject(name = "지출 내역 권한 오류", description = "지출 내역에 대한 권한이 없습니다.",