diff --git a/server/src/main/java/com/yogit/server/board/entity/Board.java b/server/src/main/java/com/yogit/server/board/entity/Board.java index 1e1a407..3709bdd 100644 --- a/server/src/main/java/com/yogit/server/board/entity/Board.java +++ b/server/src/main/java/com/yogit/server/board/entity/Board.java @@ -4,6 +4,7 @@ import com.yogit.server.board.dto.request.PatchBoardReq; import com.yogit.server.config.domain.BaseEntity; import com.yogit.server.config.domain.BaseStatus; +import com.yogit.server.report.entity.BoardReport; import com.yogit.server.user.entity.City; import com.yogit.server.user.entity.User; import lombok.AccessLevel; @@ -72,6 +73,8 @@ public class Board extends BaseEntity { @OneToMany(mappedBy = "board") private List clipBoards; + @OneToMany(mappedBy = "board") + private List boardReports; // 생성자 @Builder diff --git a/server/src/main/java/com/yogit/server/report/entity/BoardReport.java b/server/src/main/java/com/yogit/server/report/entity/BoardReport.java new file mode 100644 index 0000000..a632e71 --- /dev/null +++ b/server/src/main/java/com/yogit/server/report/entity/BoardReport.java @@ -0,0 +1,29 @@ +package com.yogit.server.report.entity; + +import com.yogit.server.board.entity.Board; +import com.yogit.server.report.enums.ReportStatus; +import com.yogit.server.report.enums.ReportType; +import com.yogit.server.user.entity.User; +import lombok.AccessLevel; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import javax.persistence.*; + +@Entity +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@DiscriminatorValue("board_report") +@Getter +public class BoardReport extends Report{ + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "board_id") + private Board board; + + @Builder + public BoardReport(String content, User reportingUser, User reportedUser, ReportType reportType, ReportStatus reportStatus, Board board) { + super(content, reportingUser, reportedUser, reportType, reportStatus); + this.board = board; + } +}