From 2c011ad8f2b9182fd58e71c4035274a0d389abc6 Mon Sep 17 00:00:00 2001 From: emilywin825 Date: Sat, 16 Sep 2023 23:16:38 +0900 Subject: [PATCH] =?UTF-8?q?[feat]Product=EC=99=80=20Image=20=EC=97=B0?= =?UTF-8?q?=EA=B4=80=EA=B4=80=EA=B3=84=20=EB=A7=A4=ED=95=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hicardi/domain/cart/dto/CartListDataResponseDTO.java | 1 + .../com/example/hicardi/domain/product/entity/Product.java | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/example/hicardi/domain/cart/dto/CartListDataResponseDTO.java b/src/main/java/com/example/hicardi/domain/cart/dto/CartListDataResponseDTO.java index 4dc8b3a..bdd77ba 100644 --- a/src/main/java/com/example/hicardi/domain/cart/dto/CartListDataResponseDTO.java +++ b/src/main/java/com/example/hicardi/domain/cart/dto/CartListDataResponseDTO.java @@ -19,6 +19,7 @@ public class CartListDataResponseDTO { private int quantity; //수량 private String productName; private String price; + private String url; public CartListDataResponseDTO(Cart cart) { this.cartId=cart.getCartId(); diff --git a/src/main/java/com/example/hicardi/domain/product/entity/Product.java b/src/main/java/com/example/hicardi/domain/product/entity/Product.java index ac05829..29c1254 100644 --- a/src/main/java/com/example/hicardi/domain/product/entity/Product.java +++ b/src/main/java/com/example/hicardi/domain/product/entity/Product.java @@ -1,5 +1,6 @@ package com.example.hicardi.domain.product.entity; +import com.example.hicardi.domain.image.entity.Image; import jakarta.persistence.*; import lombok.AllArgsConstructor; import lombok.Builder; @@ -10,6 +11,8 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; @Builder @AllArgsConstructor @@ -43,5 +46,7 @@ public class Product { private String option; - + @OneToMany(mappedBy = "product", cascade = CascadeType.ALL, orphanRemoval = true) + @Builder.Default + private List images = new ArrayList<>(); }