From 5392de61b0a995409108e179754eeb22dc352324 Mon Sep 17 00:00:00 2001 From: BeommoKoo-dev <95630007+BeommoKoo-dev@users.noreply.github.com> Date: Mon, 13 Nov 2023 17:45:21 +0900 Subject: [PATCH 1/5] =?UTF-8?q?NO-JIRA--chore=20:=20p6spy=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index 4ab9f40c..e2901112 100644 --- a/build.gradle +++ b/build.gradle @@ -30,6 +30,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'com.auth0:java-jwt:4.4.0' + implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.8.0' compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' From a03bf59b4dbf373e885758a6fa3fd1cbd68c7d4d Mon Sep 17 00:00:00 2001 From: BeommoKoo-dev <95630007+BeommoKoo-dev@users.noreply.github.com> Date: Mon, 13 Nov 2023 17:46:02 +0900 Subject: [PATCH 2/5] =?UTF-8?q?NO-JIRA--chore=20:=20=EA=B0=9C=EB=B0=9C?= =?UTF-8?q?=ED=99=98=EA=B2=BD=20p6spy=20false=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index f08c04e6..6e4f5de3 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -2,6 +2,11 @@ spring: profiles: active: local +decorator: + datasource: + p6spy: + enable-logging: false + springdoc: version: '@springdoc.version@' swagger-ui: From bc04a9918dc35c7c1e98197aea6d3fa09f49b80d Mon Sep 17 00:00:00 2001 From: BeommoKoo-dev <95630007+BeommoKoo-dev@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:31:27 +0900 Subject: [PATCH 3/5] =?UTF-8?q?NABI-204--refactor=20:=20user=EC=B9=B4?= =?UTF-8?q?=EB=93=9C=EC=A1=B0=ED=9A=8C=20join=EC=A0=88=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 | 21 ++++++++++---- .../card/repository/CardRepositoryImpl.java | 29 ++++++++++--------- .../service/CompleteRequestService.java | 11 ++++--- .../suggestion/service/SuggestionService.java | 6 ++-- 4 files changed, 39 insertions(+), 28 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 9b27235a..001e52cb 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,25 +1,36 @@ 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.request.CardStatusUpdateRequestDTO; 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.CommonResult; 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.DeleteMapping; +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.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +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 java.util.List; - import lombok.RequiredArgsConstructor; @RestController diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/card/repository/CardRepositoryImpl.java b/src/main/java/org/prgrms/nabimarketbe/domain/card/repository/CardRepositoryImpl.java index da84ae34..04624b1a 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/card/repository/CardRepositoryImpl.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/card/repository/CardRepositoryImpl.java @@ -1,13 +1,10 @@ package org.prgrms.nabimarketbe.domain.card.repository; -import com.querydsl.core.types.ConstantImpl; -import com.querydsl.core.types.Projections; -import com.querydsl.core.types.dsl.BooleanExpression; -import com.querydsl.core.types.dsl.Expressions; -import com.querydsl.core.types.dsl.StringExpressions; -import com.querydsl.core.types.dsl.StringTemplate; -import com.querydsl.jpa.impl.JPAQueryFactory; -import lombok.RequiredArgsConstructor; +import static org.prgrms.nabimarketbe.domain.card.entity.QCard.card; +import static org.prgrms.nabimarketbe.domain.item.entity.QItem.item; + +import java.util.List; + import org.prgrms.nabimarketbe.domain.card.dto.response.CardListReadPagingResponseDTO; import org.prgrms.nabimarketbe.domain.card.dto.response.CardListReadResponseDTO; import org.prgrms.nabimarketbe.domain.card.dto.response.SuggestionAvailableCardResponseDTO; @@ -17,10 +14,15 @@ import org.prgrms.nabimarketbe.domain.suggestion.entity.SuggestionType; import org.prgrms.nabimarketbe.domain.user.entity.User; -import java.util.List; +import com.querydsl.core.types.ConstantImpl; +import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.core.types.dsl.Expressions; +import com.querydsl.core.types.dsl.StringExpressions; +import com.querydsl.core.types.dsl.StringTemplate; +import com.querydsl.jpa.impl.JPAQueryFactory; -import static org.prgrms.nabimarketbe.domain.card.entity.QCard.card; -import static org.prgrms.nabimarketbe.domain.item.entity.QItem.item; +import lombok.RequiredArgsConstructor; @RequiredArgsConstructor public class CardRepositoryImpl implements CardRepositoryCustom { @@ -89,8 +91,9 @@ public CardListReadPagingResponseDTO getMyCardsByStatus( .from(card) .leftJoin(item).on(card.item.itemId.eq(item.itemId)) .where( - cursorId(cursorId), - card.status.eq(status) + cursorId(cursorId), + card.status.eq(status), + card.user.eq(user) ) .orderBy(card.createdDate.desc()) // 디폴트는 생성일자 최신순 정렬 .limit(size) diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/completeRequest/service/CompleteRequestService.java b/src/main/java/org/prgrms/nabimarketbe/domain/completeRequest/service/CompleteRequestService.java index a4fcc8a5..52faf939 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/completeRequest/service/CompleteRequestService.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/completeRequest/service/CompleteRequestService.java @@ -1,11 +1,9 @@ package org.prgrms.nabimarketbe.domain.completeRequest.service; -import lombok.RequiredArgsConstructor; - import org.prgrms.nabimarketbe.domain.card.entity.Card; import org.prgrms.nabimarketbe.domain.card.repository.CardRepository; -import org.prgrms.nabimarketbe.domain.completeRequest.dto.response.HistoryListReadLimitResponseDTO; import org.prgrms.nabimarketbe.domain.completeRequest.dto.response.CompleteRequestDTO; +import org.prgrms.nabimarketbe.domain.completeRequest.dto.response.HistoryListReadLimitResponseDTO; import org.prgrms.nabimarketbe.domain.completeRequest.dto.response.HistoryListReadPagingResponseDTO; import org.prgrms.nabimarketbe.domain.completeRequest.entity.CompleteRequest; import org.prgrms.nabimarketbe.domain.completeRequest.repository.CompleteRequestRepository; @@ -14,10 +12,11 @@ import org.prgrms.nabimarketbe.domain.user.service.CheckService; import org.prgrms.nabimarketbe.global.error.BaseException; import org.prgrms.nabimarketbe.global.error.ErrorCode; - import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import lombok.RequiredArgsConstructor; + @Service @RequiredArgsConstructor public class CompleteRequestService { @@ -82,8 +81,8 @@ public CompleteRequestDTO updateCompleteRequestStatus( private void updateStatus(Boolean isAccepted, CompleteRequest completeRequest, Card fromCard, Card toCard) { if (isAccepted) { completeRequest.acceptCompleteRequest(); - fromCard.tradeCompleted(); - toCard.tradeCompleted(); + fromCard.updateCardStatusToTradeComplete(); + toCard.updateCardStatusToTradeComplete(); } else { completeRequest.refuseCompleteRequest(); } diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/service/SuggestionService.java b/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/service/SuggestionService.java index 4f767daa..0680b6e5 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/service/SuggestionService.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/service/SuggestionService.java @@ -1,7 +1,5 @@ package org.prgrms.nabimarketbe.domain.suggestion.service; -import lombok.RequiredArgsConstructor; - import org.prgrms.nabimarketbe.domain.card.entity.Card; import org.prgrms.nabimarketbe.domain.card.repository.CardRepository; import org.prgrms.nabimarketbe.domain.suggestion.dto.request.SuggestionRequestDTO; @@ -9,7 +7,6 @@ import org.prgrms.nabimarketbe.domain.suggestion.dto.response.SuggestionResponseDTO; import org.prgrms.nabimarketbe.domain.suggestion.entity.DirectionType; import org.prgrms.nabimarketbe.domain.suggestion.entity.Suggestion; -import org.prgrms.nabimarketbe.domain.suggestion.entity.SuggestionStatus; import org.prgrms.nabimarketbe.domain.suggestion.entity.SuggestionType; import org.prgrms.nabimarketbe.domain.suggestion.repository.SuggestionRepository; import org.prgrms.nabimarketbe.domain.user.entity.User; @@ -17,10 +14,11 @@ import org.prgrms.nabimarketbe.domain.user.service.CheckService; import org.prgrms.nabimarketbe.global.error.BaseException; import org.prgrms.nabimarketbe.global.error.ErrorCode; - import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import lombok.RequiredArgsConstructor; + @Service @RequiredArgsConstructor public class SuggestionService { From 543fda401784cb13511d033f6e52fe74d993b66f Mon Sep 17 00:00:00 2001 From: BeommoKoo-dev <95630007+BeommoKoo-dev@users.noreply.github.com> Date: Mon, 13 Nov 2023 22:17:23 +0900 Subject: [PATCH 4/5] =?UTF-8?q?NABI-204--style=20:=20=EC=9D=B8=EB=8D=B4?= =?UTF-8?q?=ED=8A=B8,=20=EA=B0=9C=ED=96=89=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../response/SuggestionAvailableCardResponseDTO.java | 9 +++++++-- .../domain/suggestion/service/SuggestionService.java | 10 +++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/card/dto/response/SuggestionAvailableCardResponseDTO.java b/src/main/java/org/prgrms/nabimarketbe/domain/card/dto/response/SuggestionAvailableCardResponseDTO.java index 6a4aef6d..2606695d 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/card/dto/response/SuggestionAvailableCardResponseDTO.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/card/dto/response/SuggestionAvailableCardResponseDTO.java @@ -1,17 +1,22 @@ package org.prgrms.nabimarketbe.domain.card.dto.response; -import lombok.Getter; -import lombok.NoArgsConstructor; import org.prgrms.nabimarketbe.domain.item.entity.PriceRange; import org.prgrms.nabimarketbe.domain.suggestion.entity.SuggestionType; +import lombok.Getter; +import lombok.NoArgsConstructor; + @Getter @NoArgsConstructor public class SuggestionAvailableCardResponseDTO { private Long cardId; + private String thumbNail; + private String itemName; + private PriceRange priceRange; + private SuggestionType suggestionType; public void updateSuggestionType(SuggestionType suggestionType) { diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/service/SuggestionService.java b/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/service/SuggestionService.java index 0680b6e5..78fbc820 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/service/SuggestionService.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/service/SuggestionService.java @@ -43,13 +43,13 @@ public SuggestionResponseDTO createSuggestion( .orElseThrow(() -> new BaseException(ErrorCode.USER_NOT_MATCHED)); Card toCard = cardRepository.findById(requestDto.toCardId()) - .orElseThrow(() -> new BaseException(ErrorCode.CARD_NOT_FOUND)); + .orElseThrow(() -> new BaseException(ErrorCode.CARD_NOT_FOUND)); Suggestion suggestion = Suggestion.builder() - .suggestionType(SuggestionType.valueOf(type)) - .fromCard(fromCard) - .toCard(toCard) - .build(); + .suggestionType(SuggestionType.valueOf(type)) + .fromCard(fromCard) + .toCard(toCard) + .build(); Suggestion savedSuggestion = suggestionRepository.save(suggestion); From 55aae78dbb7f1768697c9cdfc1498f5dd7686111 Mon Sep 17 00:00:00 2001 From: BeommoKoo-dev <95630007+BeommoKoo-dev@users.noreply.github.com> Date: Mon, 13 Nov 2023 22:25:49 +0900 Subject: [PATCH 5/5] =?UTF-8?q?NABI-204--chore=20:=20yml=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 6e4f5de3..f08c04e6 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -2,11 +2,6 @@ spring: profiles: active: local -decorator: - datasource: - p6spy: - enable-logging: false - springdoc: version: '@springdoc.version@' swagger-ui: