Skip to content

Commit

Permalink
#70 #9 feat: BoardReport엔티티 정의 및 Board와 연관관계 매핑
Browse files Browse the repository at this point in the history
  • Loading branch information
xhaktmchl committed Nov 27, 2022
1 parent 907a202 commit 044d131
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/src/main/java/com/yogit/server/board/entity/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -72,6 +73,8 @@ public class Board extends BaseEntity {
@OneToMany(mappedBy = "board")
private List<ClipBoard> clipBoards;

@OneToMany(mappedBy = "board")
private List<BoardReport> boardReports;

// 생성자
@Builder
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit 044d131

Please sign in to comment.