Skip to content

Commit

Permalink
Merge pull request #105 from jhy11/community
Browse files Browse the repository at this point in the history
[fix]: 커뮤니티 글 삭제 시 관련 스크랩도 삭제되도록 수정
  • Loading branch information
jhy11 authored Aug 12, 2023
2 parents c0622c5 + db30da0 commit a5f7e82
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/com/umc/refit/domain/entity/Posts.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ public class Posts extends BaseTimeEntity {
)
private List<PostImage> image = new ArrayList<>();

@OneToMany(
mappedBy = "post",
cascade = {CascadeType.PERSIST, CascadeType.REMOVE},
orphanRemoval = true
)
private List<Scrap> scrap = new ArrayList<>();

public Posts(PostDto postDto) {
this.member = postDto.getMember();
this.title = postDto.getTitle();
Expand Down

0 comments on commit a5f7e82

Please sign in to comment.