From 0493cab61af63cb1b66cac7e9a1fd55c953d492b Mon Sep 17 00:00:00 2001 From: Kwak Seong Joon Date: Fri, 31 May 2024 05:10:39 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20Item=20=EB=8F=84=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=EB=B0=8F=20Dto=20=EC=88=98=EC=A0=95(#14)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/sopt/carrotMarket/domain/Item.java | 8 ++++++-- .../sopt/carrotMarket/service/dto/RegisterItemDTO.java | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/carrotMarket/src/main/java/org/sopt/carrotMarket/domain/Item.java b/carrotMarket/src/main/java/org/sopt/carrotMarket/domain/Item.java index babfa0b..5f841f1 100644 --- a/carrotMarket/src/main/java/org/sopt/carrotMarket/domain/Item.java +++ b/carrotMarket/src/main/java/org/sopt/carrotMarket/domain/Item.java @@ -21,6 +21,8 @@ public class Item extends BaseTimeEntity { @ManyToOne(fetch = FetchType.LAZY) private Member member; + private String imageUrl; + private String title; private int price; @@ -41,8 +43,9 @@ public class Item extends BaseTimeEntity { @Builder //빌더패턴 - private Item(Member member, String title, int price, boolean isReceived, String detailInfo, Location hopeTradeSpot) { + private Item(Member member, String imageUrl, String title, int price, boolean isReceived, String detailInfo, Location hopeTradeSpot) { this.member = member; + this.imageUrl = imageUrl; this.title = title; this.price = price; this.isReceived = isReceived; @@ -51,9 +54,10 @@ private Item(Member member, String title, int price, boolean isReceived, String } //정적팩토리메서드(빌더패턴이용) - public static Item register(Member member, String title, int price, boolean isReceived, String detailInfo, Location hopeTradeSpot) { + public static Item register(Member member, String imageUrl, String title, int price, boolean isReceived, String detailInfo, Location hopeTradeSpot) { return Item.builder() .member(member) + .imageUrl(imageUrl) .title(title) .price(price) .isReceived(isReceived) diff --git a/carrotMarket/src/main/java/org/sopt/carrotMarket/service/dto/RegisterItemDTO.java b/carrotMarket/src/main/java/org/sopt/carrotMarket/service/dto/RegisterItemDTO.java index 1a69afd..d106e71 100644 --- a/carrotMarket/src/main/java/org/sopt/carrotMarket/service/dto/RegisterItemDTO.java +++ b/carrotMarket/src/main/java/org/sopt/carrotMarket/service/dto/RegisterItemDTO.java @@ -4,6 +4,7 @@ import jakarta.validation.constraints.NotNull; import org.sopt.carrotMarket.constant.Location; import org.sopt.carrotMarket.domain.Member; +import org.springframework.web.multipart.MultipartFile; public record RegisterItemDTO( @@ -20,5 +21,7 @@ public record RegisterItemDTO( String detailInfo, @NotBlank - String hopeTradeSpot + String hopeTradeSpot, + + MultipartFile image ) { }