diff --git a/Briefing-Api/src/main/java/com/example/briefingapi/scrap/presentation/ScrapApi.java b/Briefing-Api/src/main/java/com/example/briefingapi/scrap/presentation/ScrapApi.java index c40c435..e9ff992 100644 --- a/Briefing-Api/src/main/java/com/example/briefingapi/scrap/presentation/ScrapApi.java +++ b/Briefing-Api/src/main/java/com/example/briefingapi/scrap/presentation/ScrapApi.java @@ -5,6 +5,10 @@ import com.example.briefingapi.scrap.presentation.dto.ScrapRequest; import com.example.briefingapi.scrap.presentation.dto.ScrapResponse; import com.example.briefingcommon.common.presentation.response.CommonResponse; +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 org.springframework.web.bind.annotation.*; import io.swagger.v3.oas.annotations.Operation; @@ -19,6 +23,25 @@ public class ScrapApi { @Operation(summary = "05-01 ScrapπŸ“ μŠ€ν¬λž©ν•˜κΈ° V1", description = "λΈŒλ¦¬ν•‘μ„ μŠ€ν¬λž©ν•˜λŠ” APIμž…λ‹ˆλ‹€.") @PostMapping("/scraps/briefings") + @ApiResponses({ + @ApiResponse(responseCode = "1000", description = "OK, 성곡"), + @ApiResponse( + responseCode = "AUTH003", + description = "access 토큰을 μ£Όμ„Έμš”!", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "AUTH004", + description = "acess 토큰 만료", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "AUTH006", + description = "acess 토큰 λͺ¨μ–‘이 이상함", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "MEMBER_001", + description = "μ‚¬μš©μžκ°€ μ‘΄μž¬ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + }) public CommonResponse create( @RequestBody final ScrapRequest.CreateDTO request) { return CommonResponse.onSuccess(scrapFacade.create(request)); @@ -26,6 +49,25 @@ public CommonResponse create( @Operation(summary = "05-02 ScrapπŸ“ 슀크랩 μ·¨μ†Œ V1", description = "μŠ€ν¬λž©μ„ μ·¨μ†Œν•˜λŠ” APIμž…λ‹ˆλ‹€.") @DeleteMapping("/scraps/briefings/{briefingId}/members/{memberId}") + @ApiResponses({ + @ApiResponse(responseCode = "1000", description = "OK, 성곡"), + @ApiResponse( + responseCode = "AUTH003", + description = "access 토큰을 μ£Όμ„Έμš”!", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "AUTH004", + description = "acess 토큰 만료", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "AUTH006", + description = "acess 토큰 λͺ¨μ–‘이 이상함", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "MEMBER_001", + description = "μ‚¬μš©μžκ°€ μ‘΄μž¬ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + }) public CommonResponse delete( @PathVariable final Long briefingId, @PathVariable final Long memberId) { return CommonResponse.onSuccess(scrapFacade.delete(briefingId, memberId)); @@ -33,6 +75,25 @@ public CommonResponse delete( @Operation(summary = "05-03 ScrapπŸ“ λ‚΄ 슀크랩 쑰회 V1", description = "λ‚΄ μŠ€ν¬λž©μ„ μ‘°νšŒν•˜λŠ” APIμž…λ‹ˆλ‹€.") @GetMapping("/scraps/briefings/members/{memberId}") + @ApiResponses({ + @ApiResponse(responseCode = "1000", description = "OK, 성곡"), + @ApiResponse( + responseCode = "AUTH003", + description = "access 토큰을 μ£Όμ„Έμš”!", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "AUTH004", + description = "acess 토큰 만료", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "AUTH006", + description = "acess 토큰 λͺ¨μ–‘이 이상함", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "MEMBER_001", + description = "μ‚¬μš©μžκ°€ μ‘΄μž¬ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + }) public CommonResponse> getScrapsByMember( @PathVariable final Long memberId) { return CommonResponse.onSuccess(scrapFacade.getScrapsByMemberId(memberId)); diff --git a/Briefing-Api/src/main/java/com/example/briefingapi/scrap/presentation/ScrapV2Api.java b/Briefing-Api/src/main/java/com/example/briefingapi/scrap/presentation/ScrapV2Api.java index b1e4f12..ac62315 100644 --- a/Briefing-Api/src/main/java/com/example/briefingapi/scrap/presentation/ScrapV2Api.java +++ b/Briefing-Api/src/main/java/com/example/briefingapi/scrap/presentation/ScrapV2Api.java @@ -5,6 +5,10 @@ import com.example.briefingapi.scrap.presentation.dto.ScrapRequest; import com.example.briefingapi.scrap.presentation.dto.ScrapResponse; import com.example.briefingcommon.common.presentation.response.CommonResponse; +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 org.springframework.web.bind.annotation.*; import com.example.briefingapi.aop.annotation.CacheEvictByBriefingId; @@ -22,6 +26,25 @@ public class ScrapV2Api { @CacheEvictByBriefingId(value = "findBriefingsV2", briefingId = "#request.getBriefingId()") @Operation(summary = "05-01 ScrapπŸ“ μŠ€ν¬λž©ν•˜κΈ° V2", description = "λΈŒλ¦¬ν•‘μ„ μŠ€ν¬λž©ν•˜λŠ” APIμž…λ‹ˆλ‹€.") @PostMapping("/scraps/briefings") + @ApiResponses({ + @ApiResponse(responseCode = "1000", description = "OK, 성곡"), + @ApiResponse( + responseCode = "AUTH003", + description = "access 토큰을 μ£Όμ„Έμš”!", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "AUTH004", + description = "acess 토큰 만료", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "AUTH006", + description = "acess 토큰 λͺ¨μ–‘이 이상함", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "MEMBER_001", + description = "μ‚¬μš©μžκ°€ μ‘΄μž¬ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + }) public CommonResponse createV2( @RequestBody final ScrapRequest.CreateDTO request) { return CommonResponse.onSuccess(scrapFacade.create(request)); @@ -30,6 +53,25 @@ public CommonResponse createV2( @CacheEvictByBriefingId(value = "findBriefingsV2", briefingId = "#briefingId") @Operation(summary = "05-02 ScrapπŸ“ 슀크랩 μ·¨μ†Œ V2", description = "μŠ€ν¬λž©μ„ μ·¨μ†Œν•˜λŠ” APIμž…λ‹ˆλ‹€.") @DeleteMapping("/scraps/briefings/{briefingId}/members/{memberId}") + @ApiResponses({ + @ApiResponse(responseCode = "1000", description = "OK, 성곡"), + @ApiResponse( + responseCode = "AUTH003", + description = "access 토큰을 μ£Όμ„Έμš”!", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "AUTH004", + description = "acess 토큰 만료", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "AUTH006", + description = "acess 토큰 λͺ¨μ–‘이 이상함", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "MEMBER_001", + description = "μ‚¬μš©μžκ°€ μ‘΄μž¬ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + }) public CommonResponse deleteV2( @PathVariable final Long briefingId, @PathVariable final Long memberId) { return CommonResponse.onSuccess(scrapFacade.delete(briefingId, memberId)); @@ -37,6 +79,25 @@ public CommonResponse deleteV2( @Operation(summary = "05-03 ScrapπŸ“ λ‚΄ 슀크랩 쑰회 V2", description = "λ‚΄ μŠ€ν¬λž©μ„ μ‘°νšŒν•˜λŠ” APIμž…λ‹ˆλ‹€.") @GetMapping("/scraps/briefings/members/{memberId}") + @ApiResponses({ + @ApiResponse(responseCode = "1000", description = "OK, 성곡"), + @ApiResponse( + responseCode = "AUTH003", + description = "access 토큰을 μ£Όμ„Έμš”!", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "AUTH004", + description = "acess 토큰 만료", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "AUTH006", + description = "acess 토큰 λͺ¨μ–‘이 이상함", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + @ApiResponse( + responseCode = "MEMBER_001", + description = "μ‚¬μš©μžκ°€ μ‘΄μž¬ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.", + content = @Content(schema = @Schema(implementation = CommonResponse.class))), + }) public CommonResponse> getScrapsByMemberV2( @PathVariable final Long memberId) { return CommonResponse.onSuccess(scrapFacade.getScrapsByMemberId(memberId));