Skip to content

Commit

Permalink
Merge pull request #224 from kakao-tech-campus-2nd-step3/feature/ISSU…
Browse files Browse the repository at this point in the history
…E-206

refactor: Product에서 preRemove 추가 #206
  • Loading branch information
jjt4515 authored Nov 15, 2024
2 parents 36b0f76 + 0d58a98 commit 6f4f99f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/java/poomasi/domain/product/entity/Product.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ public class Product {
@OneToOne(mappedBy = "product", cascade = CascadeType.ALL, orphanRemoval = true)
private ProductIntro productIntro;

// @PreRemove
// public void preRemove() {
// // Product가 삭제되기 전에 연관된 이미지를 삭제
// for (Image image : images) {
// image.setDeletedAt(LocalDateTime.now());
// }
// }
@PreRemove
public void preRemove() {
// Product가 삭제되기 전에 연관된 이미지를 삭제
for (Image image : images) {
image.setDeletedAt(LocalDateTime.now());
}
}

@Builder
public Product(Long productId,
Expand Down

0 comments on commit 6f4f99f

Please sign in to comment.