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(); 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 ) { 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); 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( 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( 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); diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/oauth2/google/api/GoogleOAuth2Controller.java b/src/main/java/org/prgrms/nabimarketbe/domain/oauth2/google/api/GoogleOAuth2Controller.java index acf836a8..34a85bd9 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/oauth2/google/api/GoogleOAuth2Controller.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/oauth2/google/api/GoogleOAuth2Controller.java @@ -1,15 +1,16 @@ -package org.prgrms.nabimarketbe.domain.oauth2.google.api; +package org.prgrms.nabimarketbe.oauth2.google.api; import java.io.IOException; import javax.servlet.http.HttpServletResponse; -import org.prgrms.nabimarketbe.domain.oauth2.google.service.GoogleOAuth2Service; +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; import org.prgrms.nabimarketbe.global.util.ResponseFactory; import org.prgrms.nabimarketbe.global.util.model.SingleResult; +import org.prgrms.nabimarketbe.oauth2.google.service.GoogleOAuth2Service; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -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/domain/oauth2/kakao/api/OAuth2Controller.java b/src/main/java/org/prgrms/nabimarketbe/domain/oauth2/kakao/api/OAuth2Controller.java index ced08fc9..653cef09 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/oauth2/kakao/api/OAuth2Controller.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/oauth2/kakao/api/OAuth2Controller.java @@ -1,17 +1,18 @@ -package org.prgrms.nabimarketbe.domain.oauth2.kakao.api; +package org.prgrms.nabimarketbe.oauth2.kakao.api; import java.io.IOException; import javax.servlet.http.HttpServletResponse; -import org.prgrms.nabimarketbe.domain.oauth2.kakao.dto.KakaoProfile; -import org.prgrms.nabimarketbe.domain.oauth2.kakao.service.OAuth2Service; +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; import org.prgrms.nabimarketbe.global.util.ResponseFactory; import org.prgrms.nabimarketbe.global.util.model.CommonResult; import org.prgrms.nabimarketbe.global.util.model.SingleResult; +import org.prgrms.nabimarketbe.oauth2.kakao.dto.KakaoProfile; +import org.prgrms.nabimarketbe.oauth2.kakao.service.OAuth2Service; import org.springframework.core.env.Environment; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -28,6 +29,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +@Tag(name = "카카오 소셜 로그인", description = "소셜 로그인(카카오)") @Slf4j @RestController @RequiredArgsConstructor 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 ) { 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); 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);