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())); }