From 71bf2930d5e709fd2095fe82af0d3e2b3165cfed Mon Sep 17 00:00:00 2001 From: YongHwan Kim Date: Mon, 2 Oct 2023 12:30:16 +0900 Subject: [PATCH] =?UTF-8?q?#128=20feat:=20=EC=83=81=ED=92=88=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20=EC=9D=91=EB=8B=B5=EC=97=90=20?= =?UTF-8?q?=ED=8C=90=EB=A7=A4=EC=9E=90=EC=9D=98=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=EC=95=84=EC=9D=B4=EB=94=94=20sellerId=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#130)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/codesquard/app/api/item/ItemService.java | 1 + .../java/codesquard/app/api/item/response/ItemResponse.java | 1 + .../codesquard/app/domain/item/ItemPaginationRepository.java | 3 ++- .../src/test/java/codesquard/app/api/item/ItemServiceTest.java | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/codesquard/app/api/item/ItemService.java b/backend/src/main/java/codesquard/app/api/item/ItemService.java index 387e7cc19..51ea47711 100644 --- a/backend/src/main/java/codesquard/app/api/item/ItemService.java +++ b/backend/src/main/java/codesquard/app/api/item/ItemService.java @@ -195,6 +195,7 @@ private Item findItemByItemIdAndMemberId(Long itemId, Long memberId) { @Transactional public void deleteItem(Long itemId, Principal writer) { + log.info("상품 게시글 삭제 서비스 요청 : itemId={}, writer={}", itemId, writer); Item item = findItemByItemIdAndMemberId(itemId, writer.getMemberId()); List images = imageRepository.findAllByItemId(item.getId()); images.stream() diff --git a/backend/src/main/java/codesquard/app/api/item/response/ItemResponse.java b/backend/src/main/java/codesquard/app/api/item/response/ItemResponse.java index d02939c03..11c920fd6 100644 --- a/backend/src/main/java/codesquard/app/api/item/response/ItemResponse.java +++ b/backend/src/main/java/codesquard/app/api/item/response/ItemResponse.java @@ -17,4 +17,5 @@ public class ItemResponse { private ItemStatus status; private Long chatCount; private Long wishCount; + private String sellerId; } diff --git a/backend/src/main/java/codesquard/app/domain/item/ItemPaginationRepository.java b/backend/src/main/java/codesquard/app/domain/item/ItemPaginationRepository.java index 46a155b13..c5a3a213a 100644 --- a/backend/src/main/java/codesquard/app/domain/item/ItemPaginationRepository.java +++ b/backend/src/main/java/codesquard/app/domain/item/ItemPaginationRepository.java @@ -30,7 +30,8 @@ public Slice findByIdAndRegion(Long itemId, String region, int siz item.price, item.status, item.wishCount, - item.chatCount)) + item.chatCount, + item.member.loginId.as("sellerId"))) .from(item) .where(itemRepository.lessThanItemId(itemId), itemRepository.equalCategoryId(categoryId), diff --git a/backend/src/test/java/codesquard/app/api/item/ItemServiceTest.java b/backend/src/test/java/codesquard/app/api/item/ItemServiceTest.java index 04b831859..24f79ef81 100644 --- a/backend/src/test/java/codesquard/app/api/item/ItemServiceTest.java +++ b/backend/src/test/java/codesquard/app/api/item/ItemServiceTest.java @@ -166,6 +166,7 @@ void findAll() { assertAll( () -> assertThat(contents.size()).isEqualTo(2), () -> assertThat(contents.get(0).getTitle()).isEqualTo("노트북"), + () -> assertThat(contents.get(0).getSellerId()).isEqualTo("pieeeeeee"), () -> assertThat(all.getPaging().isHasNext()).isTrue(), () -> assertThat(all.getPaging().getNextCursor()).isEqualTo(item.getId())); }