From d70e905e12ec45b3fdec705c3ec6bd183b6eb3b5 Mon Sep 17 00:00:00 2001 From: BeommoKoo-dev <95630007+BeommoKoo-dev@users.noreply.github.com> Date: Sat, 11 Nov 2023 21:54:10 +0900 Subject: [PATCH] =?UTF-8?q?NABI-124--refactor=20:=20=EC=B0=9C=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=EC=A1=B0=ED=9A=8C=20status=20=EB=B0=98=ED=99=98=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 --- .../domain/card/api/CardController.java | 16 +++++++++++----- .../domain/card/service/CardService.java | 2 ++ .../domain/dibs/api/DibController.java | 4 ++-- .../dto/response/DibListReadResponseDTO.java | 3 +++ .../dibs/repository/DibRepositoryCustom.java | 2 +- .../dibs/repository/DibRepositoryImpl.java | 5 +++-- .../domain/dibs/service/DibService.java | 4 ++-- 7 files changed, 24 insertions(+), 12 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 93d2d504..1f62542e 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,27 +1,33 @@ package org.prgrms.nabimarketbe.domain.card.api; -import lombok.RequiredArgsConstructor; +import java.util.List; import org.prgrms.nabimarketbe.domain.card.dto.request.CardCreateRequestDTO; import org.prgrms.nabimarketbe.domain.card.dto.response.CardCreateResponseDTO; import org.prgrms.nabimarketbe.domain.card.dto.response.CardListReadPagingResponseDTO; +import org.prgrms.nabimarketbe.domain.card.dto.response.CardListResponseDTO; import org.prgrms.nabimarketbe.domain.card.dto.response.CardSingleReadResponseDTO; +import org.prgrms.nabimarketbe.domain.card.dto.response.SuggestionAvailableCardResponseDTO; import org.prgrms.nabimarketbe.domain.card.entity.CardStatus; 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.ResponseFactory; import org.prgrms.nabimarketbe.global.util.model.SingleResult; - import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +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; import lombok.RequiredArgsConstructor; -import java.util.List; - @RestController @RequestMapping("/api/v1/cards") @RequiredArgsConstructor diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/card/service/CardService.java b/src/main/java/org/prgrms/nabimarketbe/domain/card/service/CardService.java index 4889958a..1bb63e1c 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/card/service/CardService.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/card/service/CardService.java @@ -6,7 +6,9 @@ import org.prgrms.nabimarketbe.domain.card.dto.request.CardCreateRequestDTO; import org.prgrms.nabimarketbe.domain.card.dto.response.CardCreateResponseDTO; import org.prgrms.nabimarketbe.domain.card.dto.response.CardListReadPagingResponseDTO; +import org.prgrms.nabimarketbe.domain.card.dto.response.CardListResponseDTO; import org.prgrms.nabimarketbe.domain.card.dto.response.CardSingleReadResponseDTO; +import org.prgrms.nabimarketbe.domain.card.dto.response.SuggestionAvailableCardResponseDTO; import org.prgrms.nabimarketbe.domain.card.entity.Card; import org.prgrms.nabimarketbe.domain.card.entity.CardStatus; import org.prgrms.nabimarketbe.domain.card.repository.CardRepository; 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 d4c145cd..aa0499f3 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 @@ -46,12 +46,12 @@ public ResponseEntity deleteDib( } @GetMapping - public ResponseEntity> getUserDibsByUserId( + public ResponseEntity> getUserDibsByDibId( @RequestHeader(name = "authorization") String token, @RequestParam(required = false) Long cursorId, @RequestParam Integer size ) { - DibListReadPagingResponseDTO dibListReadPagingResponseDTO = dibService.getUserDibsByUserId( + DibListReadPagingResponseDTO dibListReadPagingResponseDTO = dibService.getUserDibsByDibId( token, cursorId, size diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/dibs/dto/response/DibListReadResponseDTO.java b/src/main/java/org/prgrms/nabimarketbe/domain/dibs/dto/response/DibListReadResponseDTO.java index 0a8cfefe..f24b6b68 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/dibs/dto/response/DibListReadResponseDTO.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/dibs/dto/response/DibListReadResponseDTO.java @@ -1,5 +1,6 @@ package org.prgrms.nabimarketbe.domain.dibs.dto.response; +import org.prgrms.nabimarketbe.domain.card.entity.CardStatus; import org.prgrms.nabimarketbe.domain.item.entity.PriceRange; import lombok.Getter; @@ -19,4 +20,6 @@ public class DibListReadResponseDTO { private PriceRange priceRange; private String thumbNail; + + private CardStatus status; } diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/dibs/repository/DibRepositoryCustom.java b/src/main/java/org/prgrms/nabimarketbe/domain/dibs/repository/DibRepositoryCustom.java index 797b457d..848eb56e 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/dibs/repository/DibRepositoryCustom.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/dibs/repository/DibRepositoryCustom.java @@ -3,7 +3,7 @@ import org.prgrms.nabimarketbe.domain.dibs.dto.response.DibListReadPagingResponseDTO; public interface DibRepositoryCustom { - DibListReadPagingResponseDTO getUserDibsByUserId( + DibListReadPagingResponseDTO getUserDibsByDibId( Long userId, Long cursorId, Integer size diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/dibs/repository/DibRepositoryImpl.java b/src/main/java/org/prgrms/nabimarketbe/domain/dibs/repository/DibRepositoryImpl.java index a9c6b187..8e73b8e6 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/dibs/repository/DibRepositoryImpl.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/dibs/repository/DibRepositoryImpl.java @@ -19,7 +19,7 @@ public class DibRepositoryImpl implements DibRepositoryCustom{ private final JPAQueryFactory jpaQueryFactory; @Override - public DibListReadPagingResponseDTO getUserDibsByUserId( + public DibListReadPagingResponseDTO getUserDibsByDibId( Long userId, Long cursorId, Integer size @@ -32,7 +32,8 @@ public DibListReadPagingResponseDTO getUserDibsByUserId( card.cardTitle, card.item.itemName, card.item.priceRange, - card.thumbNailImage.as("thumbNail") + card.thumbNailImage.as("thumbNail"), + card.status ) ) .from(dib) diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/dibs/service/DibService.java b/src/main/java/org/prgrms/nabimarketbe/domain/dibs/service/DibService.java index 9ff7d542..f6a726d0 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/dibs/service/DibService.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/dibs/service/DibService.java @@ -78,7 +78,7 @@ public void deleteDib( } @Transactional(readOnly = true) - public DibListReadPagingResponseDTO getUserDibsByUserId( + public DibListReadPagingResponseDTO getUserDibsByDibId( String token, Long cursorId, Integer size @@ -88,7 +88,7 @@ public DibListReadPagingResponseDTO getUserDibsByUserId( throw new RuntimeException("해당 회원이 없습니다."); } - DibListReadPagingResponseDTO dibListReadPagingResponseDTO = dibRepository.getUserDibsByUserId( + DibListReadPagingResponseDTO dibListReadPagingResponseDTO = dibRepository.getUserDibsByDibId( userId, cursorId, size