From afe7256be5779dd989f1275b058d33b6a506445c Mon Sep 17 00:00:00 2001 From: hi-june Date: Mon, 18 Dec 2023 14:29:47 +0900 Subject: [PATCH 01/10] =?UTF-8?q?NABI-374--feat=20:=20card=20=EB=8F=84?= =?UTF-8?q?=EB=A9=94=EC=9D=B8=20api=20=EB=AA=85=EC=84=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/card/api/CardController.java | 44 +++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/card/api/CardController.java b/src/main/java/org/prgrms/nabimarketbe/domain/card/api/CardController.java index 1c0d8ad7..32affd43 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/card/api/CardController.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/card/api/CardController.java @@ -1,8 +1,9 @@ package org.prgrms.nabimarketbe.domain.card.api; +import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.prgrms.nabimarketbe.domain.card.dto.request.CardCreateRequestDTO; import org.prgrms.nabimarketbe.domain.card.dto.request.CardStatusUpdateRequestDTO; @@ -19,7 +20,6 @@ import org.prgrms.nabimarketbe.domain.card.service.CardService; import org.prgrms.nabimarketbe.domain.category.entity.CategoryEnum; import org.prgrms.nabimarketbe.domain.item.entity.PriceRange; -import org.prgrms.nabimarketbe.global.util.KeyGenerator; import org.prgrms.nabimarketbe.global.util.OrderCondition; import org.prgrms.nabimarketbe.global.util.ResponseFactory; import org.prgrms.nabimarketbe.global.util.model.CommonResult; @@ -38,21 +38,19 @@ import java.util.List; +@Tag(name = "카드", description = "카드 관련 API 입니다.") @RestController @RequestMapping("/api/v1/cards") @RequiredArgsConstructor public class CardController { private final CardService cardService; - @Parameter( - name = "Authorization", - description = "로그인 성공 후 AccessToken", - required = true, - schema = @Schema(type = "string"), - in = ParameterIn.HEADER) + @Operation(summary = "카드 등록", description = "카드를 등록합니다.") @PostMapping public ResponseEntity>> createCard( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader("Authorization") String token, + @Parameter(description = "카드 등록 요청값", required = true) @RequestBody CardCreateRequestDTO cardCreateRequestDTO ) { CardResponseDTO card = cardService.createCard(token, cardCreateRequestDTO); @@ -60,9 +58,12 @@ public ResponseEntity>> crea return ResponseEntity.ok(ResponseFactory.getSingleResult(card)); } + @Operation(summary = "카드 단건 조회", description = "카드 한 건을 조회합니다.") @GetMapping("/{cardId}") public ResponseEntity> getCardById( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", in = ParameterIn.HEADER) @RequestHeader(value = "Authorization", required = false) String token, + @Parameter(description = "카드 id(pk)", required = true) @PathVariable Long cardId ) { CardUserResponseDTO cardSingleReadResponseDTO = cardService.getCardById( @@ -73,13 +74,20 @@ public ResponseEntity> getCardById( return ResponseEntity.ok(ResponseFactory.getSingleResult(cardSingleReadResponseDTO)); } + @Operation(summary = "카드 목록 조회", description = "카드 목록을 조건에 따라 조회합니다.") @GetMapping public ResponseEntity> getCardsByCondition( + @Parameter(description = "카테고리") @RequestParam(required = false) CategoryEnum category, + @Parameter(description = "가격대") @RequestParam(required = false) PriceRange priceRange, + @Parameter(description = "카드 상태(거래 가능, 예약중, 거래 완료)") @RequestParam(required = false) List status, + @Parameter(description = "카드 제목") @RequestParam(required = false) String cardTitle, + @Parameter(description = "커서 id") @RequestParam(required = false) String cursorId, + @Parameter(description = "page 크기", required = true) @RequestParam Integer size ) { // TODO: 클라이언트에게 정렬 조건 받도록 추후에 수정하면 더 유연할 듯 @@ -98,9 +106,12 @@ public ResponseEntity> getCardsByCondition( return ResponseEntity.ok(ResponseFactory.getSingleResult(cardListReadPagingResponseDTO)); } + @Operation(summary = "제안 가능한 내 카드 리슨트 조회", description = "특정 카드에 제안할 수 있는 내 카드 목록을 조회합니다.") @GetMapping("/{cardId}/available-cards") public ResponseEntity>> getSuggestionAvailableCards( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "Authorization") String token, + @Parameter(description = "제안 하고 싶은 상대방의 카드 id(pk)", required = true) @PathVariable(name = "cardId") Long targetCardId ) { CardListResponseDTO cardListResponseDTO @@ -109,10 +120,14 @@ public ResponseEntity>> updateCardById( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader("Authorization") String token, + @Parameter(description = "자신의 카드 id(pk)", required = true) @PathVariable Long cardId, + @Parameter(description = "카드 수정 요청값", required = true) @RequestBody CardUpdateRequestDTO cardUpdateRequestDTO ) { CardResponseDTO cardResponseDTO = cardService.updateCardById( @@ -124,10 +139,14 @@ public ResponseEntity>> upda return ResponseEntity.ok(ResponseFactory.getSingleResult(cardResponseDTO)); } + @Operation(summary = "카드에 대한 제안 결정", description = "자신의 카드에 들어온 제안에 대해 결정합니다.") @PutMapping("/status/{cardId}") public ResponseEntity updateCardStatusById( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "Authorization") String token, + @Parameter(description = "자신의 카드 id(pk)", required = true) @PathVariable Long cardId, + @Parameter(description = "카드 제안에 대한 결정 결과값") @RequestBody CardStatusUpdateRequestDTO cardStatusUpdateRequestDTO ) { cardService.updateCardStatusById( @@ -139,11 +158,16 @@ public ResponseEntity updateCardStatusById( return ResponseEntity.ok(ResponseFactory.getSuccessResult()); } + @Operation(summary = "자신의 카드 목록 조회(상태 기반)", description = "카드 상태에 따른 자신의 카드 목록을 조회합니다.") @GetMapping("/{status}/my-cards") public ResponseEntity> getMyCardsByStatus( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "Authorization") String token, + @Parameter(description = "카드 상태", required = true) @PathVariable CardStatus status, + @Parameter(description = "커서 id") @RequestParam(required = false) String cursorId, + @Parameter(description = "page 크기", required = true) @RequestParam Integer size ) { CardPagingResponseDTO cardListReadPagingResponseDTO = cardService.getMyCardsByStatus( @@ -156,9 +180,12 @@ public ResponseEntity> getMyCardsByStatus( return ResponseEntity.ok(ResponseFactory.getSingleResult(cardListReadPagingResponseDTO)); } + @Operation(summary = "카드 삭제", description = "자신의 카드를 삭제합니다.") @DeleteMapping("/{cardId}") public ResponseEntity deleteCardById( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "Authorization") String token, + @Parameter(description = "삭제하고자 하는 자신의 카드 id(pk)", required = true) @PathVariable Long cardId ) { cardService.deleteCardById(token, cardId); @@ -166,6 +193,7 @@ public ResponseEntity deleteCardById( return ResponseEntity.ok(ResponseFactory.getSuccessResult()); } + @Operation(summary = "인기 상품 목록 조회", description = "메인 베너에 띄우는 인기 상품 목록을 조회합니다.") @GetMapping("/popular") public ResponseEntity>> getCardsByPopularity() { CardListResponseDTO cardList = cardService.getCardsByPopularity(); From 0b5548ad5785cb436759075609b57666859a93f4 Mon Sep 17 00:00:00 2001 From: hi-june Date: Mon, 18 Dec 2023 14:29:57 +0900 Subject: [PATCH 02/10] =?UTF-8?q?NABI-374--feat=20:=20card=20=EB=8F=84?= =?UTF-8?q?=EB=A9=94=EC=9D=B8=20api=20=EB=AA=85=EC=84=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../card/dto/request/CardCreateRequestDTO.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/card/dto/request/CardCreateRequestDTO.java b/src/main/java/org/prgrms/nabimarketbe/domain/card/dto/request/CardCreateRequestDTO.java index 43fb23a0..6d6b8326 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/card/dto/request/CardCreateRequestDTO.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/card/dto/request/CardCreateRequestDTO.java @@ -7,6 +7,7 @@ import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; +import io.swagger.v3.oas.annotations.media.Schema; import org.prgrms.nabimarketbe.domain.card.entity.Card; import org.prgrms.nabimarketbe.domain.card.entity.TradeType; import org.prgrms.nabimarketbe.domain.cardimage.dto.request.CardImageCreateRequestDTO; @@ -17,38 +18,49 @@ import org.prgrms.nabimarketbe.domain.user.entity.User; import org.prgrms.nabimarketbe.global.annotation.ValidEnum; +@Schema(title = "카드 등록 요청값 body data", description = "카드 등록 요청에 필요한 값들입니다.") public record CardCreateRequestDTO( + @Schema(title = "카드 제목", description = "카드 제목입니다.", example = "나비 카드 교환 원해요~") @NotBlank(message = "공백을 허용하지 않습니다.") @Size(max = 30) String cardTitle, + @Schema(title = "썸네일 링크", description = "썸네일 이미지 링크입니다.", example = "https://xxx.amazonaws.com/xxx.png") @NotBlank(message = "공백을 허용하지 않습니다.") String thumbnail, + @Schema(title = "아이템 이름", description = "아이템 이름입니다.", example = "나비 카드") @NotBlank(message = "공백을 허용하지 않습니다.") @Size(max = 30) String itemName, + @Schema(title = "가격대", description = "상품의 가격대입니다.", example = "PRICE_RANGE_ONE") @ValidEnum(enumClass = PriceRange.class, message = "유효하지 않은 가격대입니다.") PriceRange priceRange, + @Schema(title = "거래 방식", description = "카드의 거래 방식을 의미합니다.", example = "DIRECT_DEALING") @ValidEnum(enumClass = TradeType.class, message = "유효하지 않은 거래 방식입니다.") TradeType tradeType, + @Schema(title = "거래 지역", description = "거래 하고자 하는 지역을 의미합니다.", example = "서울시 노원구") @NotNull @Size(max = 30) String tradeArea, + @Schema(title = "카드 카테고리", description = "카드의 카테고리를 의미합니다.", example = "SHOES") @ValidEnum(enumClass = CategoryEnum.class, message = "유효하지 않은 카테고리입니다.") CategoryEnum category, + @Schema(title = "카드 찔러보기 유무", description = "카드의 찔러보기 허용 여부를 의미합니다.", example = "true") @NotNull(message = "비울 수 없는 값입니다.") Boolean pokeAvailable, + @Schema(title = "카드 본문 내용", description = "카드의 본문 내용을 의미합니다.", example = "나비 카드 교환원합니다. 상태 좋아요~!") @NotBlank(message = "공백을 허용하지 않습니다.") @Size(max = 255) String content, + @Schema(title = "카드 이미지 링크 목록", description = "카드의 이미지 링크 목록") @Nullable List images ) { From 897eb0820240d0bb5b4fa77717cd79ae9561af64 Mon Sep 17 00:00:00 2001 From: hi-june Date: Mon, 18 Dec 2023 14:30:25 +0900 Subject: [PATCH 03/10] =?UTF-8?q?NABI-374--feat=20:=20chatroom=20=EB=8F=84?= =?UTF-8?q?=EB=A9=94=EC=9D=B8=20api=20=EB=AA=85=EC=84=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/chatroom/api/CharRoomController.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/chatroom/api/CharRoomController.java b/src/main/java/org/prgrms/nabimarketbe/domain/chatroom/api/CharRoomController.java index 48d90dbc..a9a72f60 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/chatroom/api/CharRoomController.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/chatroom/api/CharRoomController.java @@ -1,5 +1,9 @@ package org.prgrms.nabimarketbe.domain.chatroom.api; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.prgrms.nabimarketbe.domain.chatroom.dto.response.list.ChatRoomListWrapper; import org.prgrms.nabimarketbe.domain.chatroom.dto.response.single.ChatRoomInfoWrapper; @@ -14,15 +18,19 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +@Tag(name = "채팅방", description = "채팅방 생성 및 접근 관련 API 입니다.") @RestController @RequestMapping("/api/v1/chats") @RequiredArgsConstructor public class CharRoomController { private final ChatRoomService chatRoomService; + @Operation(summary = "채팅방 단건 조회", description = "채팅방 단건 조회를 할 수 있습니다.") @GetMapping("/{chatRoomId}") public ResponseEntity> getChatRoomById( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "Authorization") String token, + @Parameter(description = "채팅방 접근을 위한 id(pk)", required = true) @PathVariable Long chatRoomId ) { ChatRoomInfoWrapper charRoomInfo = chatRoomService.getChatRoomById(token, chatRoomId); @@ -30,10 +38,14 @@ public ResponseEntity> getChatRoomById( return ResponseEntity.ok(ResponseFactory.getSingleResult(charRoomInfo)); } + @Operation(summary = "채팅방 목록 조회", description = "개설된 채팅방 목록 조회를 할 수 있습니다.") @GetMapping public ResponseEntity> getChatRooms( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "Authorization") String token, + @Parameter(description = "채팅방 목록 페이징을 위한 cursor id") @RequestParam(required = false) String cursorId, + @Parameter(description = "채팅방 목록 페이지 크기", required = true) @RequestParam Integer size ) { ChatRoomListWrapper chatRoomList = chatRoomService.getChatRooms(token, cursorId, size); From 55ef14f9361616725c3b58a7ae77c2305947729b Mon Sep 17 00:00:00 2001 From: hi-june Date: Mon, 18 Dec 2023 14:30:56 +0900 Subject: [PATCH 04/10] =?UTF-8?q?NABI-374--feat=20:=20=EA=B1=B0=EB=9E=98?= =?UTF-8?q?=20=EC=84=B1=EC=82=AC=20=EB=8F=84=EB=A9=94=EC=9D=B8=20api=20?= =?UTF-8?q?=EB=AA=85=EC=84=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/CompleteRequestController.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/completeRequest/api/CompleteRequestController.java b/src/main/java/org/prgrms/nabimarketbe/domain/completeRequest/api/CompleteRequestController.java index b94a16a4..3340c353 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/completeRequest/api/CompleteRequestController.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/completeRequest/api/CompleteRequestController.java @@ -1,5 +1,9 @@ package org.prgrms.nabimarketbe.domain.completeRequest.api; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.tags.Tag; import org.prgrms.nabimarketbe.domain.completeRequest.dto.request.CompleteRequestDTO; import org.prgrms.nabimarketbe.domain.completeRequest.dto.request.CompleteRequestUpdateDTO; import org.prgrms.nabimarketbe.domain.completeRequest.dto.response.CompleteRequestResponseDTO; @@ -23,15 +27,19 @@ import lombok.RequiredArgsConstructor; +@Tag(name = "거래 성사", description = "거래 성사 요청 관련 API 입니다.") @RestController @RequiredArgsConstructor @RequestMapping("/api/v1/complete-requests") public class CompleteRequestController { private final CompleteRequestService completeRequestService; + @Operation(summary = "거래 성사 요청", description = "거래 성사 요청을 보냅니다.") @PostMapping public ResponseEntity> createCompleteRequest( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "Authorization") String token, + @Parameter(description = "거래 성사 요청값", required = true) @RequestBody CompleteRequestDTO completeRequestDTO ) { CompleteRequestResponseDTO completeRequestResponseDTO = completeRequestService.createCompleteRequest( @@ -42,17 +50,25 @@ public ResponseEntity> createCompleteRe return ResponseEntity.ok(ResponseFactory.getSingleResult(completeRequestResponseDTO)); } + @Operation(summary = "거래 성사 히스토리", description = "성사된 거래의 목록을 조회합니다.") @GetMapping - public ResponseEntity> getHistoryBySize(@RequestParam Integer size) { + public ResponseEntity> getHistoryBySize( + @Parameter(description = "페이지 size", required = true) + @RequestParam Integer size + ) { HistoryListReadLimitResponseDTO historyListReadLimitResponseDTO = completeRequestService.getHistoryBySize(size); return ResponseEntity.ok(ResponseFactory.getSingleResult(historyListReadLimitResponseDTO)); } + @Operation(summary = "유저별 거래 성사 내역 조회", description = "유저 별 성사된 거래의 목록을 조회합니다.") @GetMapping("/user") public ResponseEntity> getHistoryByUser( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader("Authorization") String token, + @Parameter(description = "커서 id") @RequestParam(required = false) String cursorId, + @Parameter(description = "페이지 size", required = true) @RequestParam Integer size ){ HistoryListReadPagingResponseDTO historyByUser = completeRequestService.getHistoryByUser( @@ -64,9 +80,13 @@ public ResponseEntity> getHistory return ResponseEntity.ok(ResponseFactory.getSingleResult(historyByUser)); } + + @Operation(summary = "거래 성사 요청 단건 조회", description = "거래 성사 요청 단건 조회합니다.") @GetMapping("/{completeRequestId}") public ResponseEntity> getCompleteRequestById( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "Authorization") String token, + @Parameter(description = "거래 성사 요청 id(pk)", required = true) @PathVariable Long completeRequestId ) { CompleteRequestInfoDTO completeRequestById = completeRequestService.getCompleteRequestById( @@ -77,9 +97,12 @@ public ResponseEntity> getCompleteRequestBy return ResponseEntity.ok((ResponseFactory.getSingleResult(completeRequestById))); } + @Operation(summary = "거래 성사 요청 응답", description = "들어온 거래 성사 요청에 대해 응답합니다.") @PutMapping("/confirm") public ResponseEntity> updateCompleteRequestStatus( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "Authorization") String token, + @Parameter(description = "거래 성사 요청에 대한 응답", required = true) @RequestBody CompleteRequestUpdateDTO completeRequestUpdateDTO ) { CompleteRequestResponseDTO completeRequestDTO = completeRequestService.updateCompleteRequestStatus( From dc8a27df750238f59dc896153ccb5b5561fc33a6 Mon Sep 17 00:00:00 2001 From: hi-june Date: Mon, 18 Dec 2023 14:31:15 +0900 Subject: [PATCH 05/10] =?UTF-8?q?NABI-374--feat=20:=20=EC=B0=9C=ED=95=98?= =?UTF-8?q?=EA=B8=B0=20=EB=8F=84=EB=A9=94=EC=9D=B8=20api=20=EB=AA=85?= =?UTF-8?q?=EC=84=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/dibs/api/DibController.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/dibs/api/DibController.java b/src/main/java/org/prgrms/nabimarketbe/domain/dibs/api/DibController.java index c07a7319..17997efc 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/dibs/api/DibController.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/dibs/api/DibController.java @@ -1,5 +1,9 @@ package org.prgrms.nabimarketbe.domain.dibs.api; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.tags.Tag; import org.prgrms.nabimarketbe.domain.dibs.dto.response.DibCreateResponseDTO; import org.prgrms.nabimarketbe.domain.dibs.dto.response.wrapper.DibListReadPagingResponseDTO; import org.prgrms.nabimarketbe.domain.dibs.dto.response.wrapper.DibResponseDTO; @@ -19,15 +23,19 @@ import lombok.RequiredArgsConstructor; +@Tag(name = "찜", description = "찜 기능 관련 API 입니다.") @RequiredArgsConstructor @RequestMapping("/api/v1/dibs") @RestController public class DibController { private final DibService dibService; + @Operation(summary = "카드 찜 하기", description = "맘에 드는 카드를 찜할 수 있습니다.") @PostMapping("/{cardId}") public ResponseEntity>> createDib( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "Authorization") String token, + @Parameter(description = "카드 id(pk)", required = true) @PathVariable Long cardId ) { DibResponseDTO dibResponseDTO = dibService.createDib(token, cardId); @@ -35,9 +43,12 @@ public ResponseEntity>> create return ResponseEntity.ok(ResponseFactory.getSingleResult(dibResponseDTO)); } + @Operation(summary = "카드 찜 취소", description = "찜한 카드를 취소할 수 있습니다.") @DeleteMapping("/{cardId}") public ResponseEntity deleteDib( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "authorization") String token, + @Parameter(description = "카드 id(pk)", required = true) @PathVariable Long cardId ) { dibService.deleteDib(token, cardId); @@ -45,10 +56,14 @@ public ResponseEntity deleteDib( return ResponseEntity.ok(ResponseFactory.getSuccessResult()); } + @Operation(summary = "찜 목록 조회", description = "찜한 카드 목록을 조회할 수 있습니다.") @GetMapping public ResponseEntity> getUserDibsByDibId( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "authorization") String token, + @Parameter(description = "커서 id") @RequestParam(required = false) Long cursorId, + @Parameter(description = "page 크기", required = true) @RequestParam Integer size ) { DibListReadPagingResponseDTO dibListReadPagingResponseDTO = dibService.getUserDibsByDibId( From ccdfa72e8ad0c9d171254889cf1ad39f89403b5c Mon Sep 17 00:00:00 2001 From: hi-june Date: Mon, 18 Dec 2023 14:31:24 +0900 Subject: [PATCH 06/10] =?UTF-8?q?NABI-374--feat=20:=20=EC=95=8C=EB=A6=BC?= =?UTF-8?q?=20=EB=8F=84=EB=A9=94=EC=9D=B8=20api=20=EB=AA=85=EC=84=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notifiaction/api/NotificationController.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/notifiaction/api/NotificationController.java b/src/main/java/org/prgrms/nabimarketbe/domain/notifiaction/api/NotificationController.java index 696f47d6..d6fef2d0 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/notifiaction/api/NotificationController.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/notifiaction/api/NotificationController.java @@ -2,6 +2,10 @@ import javax.validation.Valid; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.tags.Tag; import org.prgrms.nabimarketbe.domain.notifiaction.dto.request.NotificationReadRequestDTO; import org.prgrms.nabimarketbe.domain.notifiaction.dto.response.NotificationUnreadCountResponseDTO; import org.prgrms.nabimarketbe.domain.notifiaction.dto.response.wrapper.NotificationPagingResponseDTO; @@ -20,14 +24,17 @@ import lombok.RequiredArgsConstructor; +@Tag(name = "알림", description = "알림 기능 관련 API 입니다.") @RequiredArgsConstructor @RestController @RequestMapping("/api/v1/notifications") public class NotificationController { private final NotificationService notificationService; + @Operation(summary = "안 읽은 알림 수 조회", description = "읽지 않은 알림의 개수를 조회할 수 있습니다.") @GetMapping("/unread-count") public ResponseEntity> getUnreadNotificationCount( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader("Authorization") String token ) { NotificationUnreadCountResponseDTO responseDTO = notificationService.getUnreadNotificationCount(token); @@ -35,11 +42,16 @@ public ResponseEntity> getUnrea return ResponseEntity.ok(ResponseFactory.getSingleResult(responseDTO)); } + @Operation(summary = "알림 목록 조회", description = "읽음 여부에 따른 알림의 목록을 조회할 수 있습니다.") @GetMapping public ResponseEntity> getNotificationsByIsRead( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader("Authorization") String token, + @Parameter(description = "알림에 대한 읽음 여부(T/F)", required = true) @RequestParam("is-read") Boolean isRead, + @Parameter(description = "page 크기", required = true) @RequestParam Integer size, + @Parameter(description = "커서 id") @RequestParam(required = false) String cursorId ) { NotificationPagingResponseDTO responseDTO = notificationService.getNotificationsByIsRead( @@ -52,9 +64,12 @@ public ResponseEntity> getNotificati return ResponseEntity.ok(ResponseFactory.getSingleResult(responseDTO)); } + @Operation(summary = "알림 읽음 처리", description = "알림에 대해 읽음 처리할 수 있습니다.") @PutMapping("/read") public ResponseEntity updateNotificationToRead( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader("Authorization") String token, + @Parameter(description = "읽음 처리할 알림 id 목록", required = true) @RequestBody @Valid NotificationReadRequestDTO notificationReadRequestDTO ) { notificationService.updateNotificationToRead(token, notificationReadRequestDTO); From 10c81e23f8e1ae4cd35775fc4527adcac2ab1265 Mon Sep 17 00:00:00 2001 From: hi-june Date: Mon, 18 Dec 2023 14:31:42 +0900 Subject: [PATCH 07/10] =?UTF-8?q?NABI-374--feat=20:=20=EA=B1=B0=EB=9E=98?= =?UTF-8?q?=EC=A0=9C=EC=95=88=20=EB=8F=84=EB=A9=94=EC=9D=B8=20api=20?= =?UTF-8?q?=EB=AA=85=EC=84=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../suggestion/api/SuggestionController.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/api/SuggestionController.java b/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/api/SuggestionController.java index c5731c63..c8dc8230 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/api/SuggestionController.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/api/SuggestionController.java @@ -1,5 +1,9 @@ package org.prgrms.nabimarketbe.domain.suggestion.api; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.prgrms.nabimarketbe.domain.suggestion.dto.request.SuggestionRequestDTO; @@ -16,16 +20,21 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; +@Tag(name = "거래 제안", description = "거래 제안 요청 관련 API 입니다.") @RequestMapping("/api/v1/suggestions") @RequiredArgsConstructor @RestController public class SuggestionController { private final SuggestionService suggestionService; + @Operation(summary = "거래 제안 신청", description = "원하는 카드에 거래 제안을 신청합니다.") @PostMapping("/{suggestionType}") public ResponseEntity> createSuggestion( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "Authorization") String token, + @Parameter(description = "거래 제안 종류", required = true) @PathVariable String suggestionType, + @Parameter(description = "거래 요청에 필요한 카드 정보", required = true) @RequestBody SuggestionRequestDTO suggestionRequestDTO ) { String key = KeyGenerator.generateSuggestionLockKey( @@ -43,13 +52,20 @@ public ResponseEntity> createSuggestion( return ResponseEntity.ok(ResponseFactory.getSingleResult(suggestionResponseDTO)); } + @Operation(summary = "제안된 거래 목록 조회", description = "특정 카드에 대한 제안 목록을 조회할 수 있습니다.") @GetMapping("/{directionType}/{suggestionType}/{cardId}") public ResponseEntity> getSuggestionsByType( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "Authorization") String token, + @Parameter(description = "받은/보낸", required = true) @PathVariable String directionType, + @Parameter(description = "제안 종류", required = true) @PathVariable String suggestionType, + @Parameter(description = "카드 id(pk)", required = true) @PathVariable Long cardId, + @Parameter(description = "커서 id") @RequestParam(required = false) String cursorId, + @Parameter(description = "page 크기", required = true) @RequestParam Integer size ) { SuggestionListReadPagingResponseDTO receivedSuggestions = suggestionService.getSuggestionsByType( @@ -64,9 +80,12 @@ public ResponseEntity> getSugg return ResponseEntity.ok(ResponseFactory.getSingleResult(receivedSuggestions)); } + @Operation(summary = "제안 받은 거래에 대한 결정", description = "받은 거래 제안에 대해 결정합니다.") @PutMapping("/decision") public ResponseEntity> updateSugggestionStatus( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "Authorization") String token, + @Parameter(description = "제안 결정에 필요한 요청값", required = true) @RequestBody SuggestionUpdateRequestDTO suggestionUpdateDTO ) { From 73162f21d789af38d30d6b615864fed664e571fd Mon Sep 17 00:00:00 2001 From: hi-june Date: Mon, 18 Dec 2023 14:31:54 +0900 Subject: [PATCH 08/10] =?UTF-8?q?NABI-374--feat=20:=20user=20=EB=8F=84?= =?UTF-8?q?=EB=A9=94=EC=9D=B8=20api=20=EB=AA=85=EC=84=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/user/api/UserController.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/user/api/UserController.java b/src/main/java/org/prgrms/nabimarketbe/domain/user/api/UserController.java index 013534f4..b150cf6f 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/user/api/UserController.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/user/api/UserController.java @@ -1,5 +1,9 @@ package org.prgrms.nabimarketbe.domain.user.api; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.tags.Tag; import org.prgrms.nabimarketbe.domain.user.dto.request.UserNicknameUpdateRequestDTO; import org.prgrms.nabimarketbe.domain.user.dto.request.UserProfileUpdateRequestDTO; import org.prgrms.nabimarketbe.domain.user.dto.response.UserGetResponseDTO; @@ -20,6 +24,7 @@ import lombok.RequiredArgsConstructor; +@Tag(name = "유저", description = "유저 관련 API 입니다.") @RequiredArgsConstructor @RestController @RequestMapping("/api/v1/users") @@ -28,17 +33,23 @@ public class UserController { private final SignService signService; + @Operation(summary = "validation api") @GetMapping public ResponseEntity>> getUserByToken( - @RequestHeader(name = "authorization") String token) { + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) + @RequestHeader(name = "authorization") String token + ) { UserResponseDTO userResponseDTO = userService.getUserByToken(token); return ResponseEntity.ok(ResponseFactory.getSingleResult(userResponseDTO)); } + @Operation(summary = "유저 프로필 이미지 수정", description = "유저는 자신의 프로필 이미지를 수정할 수 있습니다.") @PutMapping("/profile-image") public ResponseEntity>> updateUserImageUrl( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "authorization") String token, + @Parameter(description = "프로필 이미지의 업로드 url 요청값", required = true) @RequestBody UserProfileUpdateRequestDTO userProfileUpdateRequestDTO ) { UserResponseDTO userResponseDTO = userService.updateUserImageUrl( @@ -49,9 +60,12 @@ public ResponseEntity>> upda return ResponseEntity.ok(ResponseFactory.getSingleResult(userResponseDTO)); } + @Operation(summary = "유저 닉네임 수정", description = "유저는 자신의 닉네임을 수정할 수 있습니다.") @PutMapping("/nickname") public ResponseEntity>> updateUserNickname( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader(name = "authorization") String token, + @Parameter(description = "유저의 새로운 닉네임 요청값", required = true) @RequestBody UserNicknameUpdateRequestDTO userNicknameUpdateRequestDTO ) { UserResponseDTO userResponseDTO = userService.updateUserNickname( @@ -62,8 +76,10 @@ public ResponseEntity>> upda return ResponseEntity.ok(ResponseFactory.getSingleResult(userResponseDTO)); } + @Operation(summary = "access 토큰 재발급", description = "access 토큰이 만료되었을 때 재발급 받을 수 있습니다.") @GetMapping("/re-issue") public ResponseEntity> reissue( + @Parameter(name = "Authorization", description = "만료 되지 않은 RefreshToken", required = true, in = ParameterIn.HEADER) @RequestHeader("Authorization") String refreshToken ) { AccessTokenResponseDTO accessTokenResponseDTO = signService.reissue(refreshToken); From 88ab6853f11e6aee8b6f6a35b67180ee3888f930 Mon Sep 17 00:00:00 2001 From: hi-june Date: Mon, 18 Dec 2023 14:42:20 +0900 Subject: [PATCH 09/10] =?UTF-8?q?NABI-374--feat=20:=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=20=EC=97=85=EB=A1=9C=EB=93=9C=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?api=20=EB=AA=85=EC=84=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/aws/api/S3FileController.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/prgrms/nabimarketbe/global/aws/api/S3FileController.java b/src/main/java/org/prgrms/nabimarketbe/global/aws/api/S3FileController.java index 9b9f0fce..a420cad0 100644 --- a/src/main/java/org/prgrms/nabimarketbe/global/aws/api/S3FileController.java +++ b/src/main/java/org/prgrms/nabimarketbe/global/aws/api/S3FileController.java @@ -2,6 +2,10 @@ import java.util.List; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -13,16 +17,15 @@ import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +@Tag(name = "이미지 업로드", description = "이미지 업로드를 위한 API 입니다.") @RestController @RequestMapping("/api/v1/s3/upload") @RequiredArgsConstructor @@ -32,9 +35,12 @@ public class S3FileController { private final CheckService checkService; + @Operation(summary = "이미지 단건 업로드", description = "하나의 이미지 파일을 업로드합니다.") @PostMapping("/single") public ResponseEntity> uploadFile( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader("Authorization") String token, + @Parameter(description = "업로드 하려는 파일(단건)", required = true) @RequestPart("file") MultipartFile file ) { String uploadUrl = s3FileUploadService.uploadFile(file); @@ -42,9 +48,12 @@ public ResponseEntity> uploadFile( return ResponseEntity.ok(ResponseFactory.getSingleResult(uploadUrl)); } + @Operation(summary = "이미지 다건 업로드", description = "여래 개의 이미지 파일을 업로드합니다.") @PostMapping("/multi") public ResponseEntity>> uploadFiles( + @Parameter(name = "Authorization", description = "로그인 성공 후 AccessToken", required = true, in = ParameterIn.HEADER) @RequestHeader("Authorization") String token, + @Parameter(description = "업로드 하려는 파일(다건)", required = true) @RequestPart("files") List files ) { List uploadUrls = s3FileUploadService.uploadFiles(files); From f60ccdfaaeb0cc2b38231838e906eb78e2912f5f Mon Sep 17 00:00:00 2001 From: hi-june Date: Mon, 18 Dec 2023 14:43:26 +0900 Subject: [PATCH 10/10] =?UTF-8?q?NABI-374--feat=20:=20=EC=86=8C=EC=85=9C?= =?UTF-8?q?=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EA=B4=80=EB=A0=A8=20api=20?= =?UTF-8?q?=EB=AA=85=EC=84=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nabimarketbe/oauth2/google/api/GoogleOAuth2Controller.java | 2 ++ .../prgrms/nabimarketbe/oauth2/kakao/api/OAuth2Controller.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/main/java/org/prgrms/nabimarketbe/oauth2/google/api/GoogleOAuth2Controller.java b/src/main/java/org/prgrms/nabimarketbe/oauth2/google/api/GoogleOAuth2Controller.java index 5d01b21b..34a85bd9 100644 --- a/src/main/java/org/prgrms/nabimarketbe/oauth2/google/api/GoogleOAuth2Controller.java +++ b/src/main/java/org/prgrms/nabimarketbe/oauth2/google/api/GoogleOAuth2Controller.java @@ -4,6 +4,7 @@ import javax.servlet.http.HttpServletResponse; +import io.swagger.v3.oas.annotations.tags.Tag; import org.prgrms.nabimarketbe.domain.user.dto.request.SocialUserInfoDTO; import org.prgrms.nabimarketbe.domain.user.dto.response.UserLoginResponseDTO; import org.prgrms.nabimarketbe.domain.user.service.SignService; @@ -21,6 +22,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +@Tag(name = "구글 소셜 로그인", description = "소셜 로그인(구글)") @RestController @RequiredArgsConstructor @Slf4j diff --git a/src/main/java/org/prgrms/nabimarketbe/oauth2/kakao/api/OAuth2Controller.java b/src/main/java/org/prgrms/nabimarketbe/oauth2/kakao/api/OAuth2Controller.java index bc469e8c..5401cc16 100644 --- a/src/main/java/org/prgrms/nabimarketbe/oauth2/kakao/api/OAuth2Controller.java +++ b/src/main/java/org/prgrms/nabimarketbe/oauth2/kakao/api/OAuth2Controller.java @@ -4,6 +4,7 @@ import javax.servlet.http.HttpServletResponse; +import io.swagger.v3.oas.annotations.tags.Tag; import org.prgrms.nabimarketbe.domain.user.dto.request.SocialUserInfoDTO; import org.prgrms.nabimarketbe.domain.user.dto.response.UserLoginResponseDTO; import org.prgrms.nabimarketbe.domain.user.service.SignService; @@ -28,6 +29,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +@Tag(name = "카카오 소셜 로그인", description = "소셜 로그인(카카오)") @Slf4j @RestController @RequiredArgsConstructor