Skip to content

Commit

Permalink
📝 Docs : 인가 처리가 필요한 API 대상 토큰 관련 명세 진행 (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
CYY1007 authored Feb 8, 2024
1 parent 6a9bcf3 commit fac9808
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,20 +23,77 @@ 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<ScrapResponse.CreateDTO> create(
@RequestBody final ScrapRequest.CreateDTO request) {
return CommonResponse.onSuccess(scrapFacade.create(request));
}

@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<ScrapResponse.DeleteDTO> delete(
@PathVariable final Long briefingId, @PathVariable final Long memberId) {
return CommonResponse.onSuccess(scrapFacade.delete(briefingId, memberId));
}

@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<List<ScrapResponse.ReadDTO>> getScrapsByMember(
@PathVariable final Long memberId) {
return CommonResponse.onSuccess(scrapFacade.getScrapsByMemberId(memberId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<ScrapResponse.CreateDTOV2> createV2(
@RequestBody final ScrapRequest.CreateDTO request) {
return CommonResponse.onSuccess(scrapFacade.create(request));
Expand All @@ -30,13 +53,51 @@ public CommonResponse<ScrapResponse.CreateDTOV2> 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<ScrapResponse.DeleteDTOV2> deleteV2(
@PathVariable final Long briefingId, @PathVariable final Long memberId) {
return CommonResponse.onSuccess(scrapFacade.delete(briefingId, memberId));
}

@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<List<ScrapResponse.ReadDTOV2>> getScrapsByMemberV2(
@PathVariable final Long memberId) {
return CommonResponse.onSuccess(scrapFacade.getScrapsByMemberId(memberId));
Expand Down

0 comments on commit fac9808

Please sign in to comment.