From 044d131d533899c771731118d2972e527bf29fdd Mon Sep 17 00:00:00 2001 From: xhaktmchl Date: Sun, 27 Nov 2022 13:40:36 +0900 Subject: [PATCH] =?UTF-8?q?#70=20#9=20feat:=20BoardReport=EC=97=94?= =?UTF-8?q?=ED=8B=B0=ED=8B=B0=20=EC=A0=95=EC=9D=98=20=EB=B0=8F=20Board?= =?UTF-8?q?=EC=99=80=20=EC=97=B0=EA=B4=80=EA=B4=80=EA=B3=84=20=EB=A7=A4?= =?UTF-8?q?=ED=95=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yogit/server/board/entity/Board.java | 3 ++ .../server/report/entity/BoardReport.java | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 server/src/main/java/com/yogit/server/report/entity/BoardReport.java 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; + } +}