Merge branch 'Be/Report' into 'backend'
[Back-End] feat : cascade 추가 See merge request s11-webmobile1-sub2/S11P12A701!154
This commit is contained in:
commit
7a1aaf8f80
@ -4,6 +4,8 @@ package com.edufocus.edufocus.report.entity.vo;
|
||||
import com.edufocus.edufocus.quiz.entity.Quiz;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@ -17,15 +19,21 @@ public class Answer {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private long id;
|
||||
|
||||
@Column
|
||||
private String userAnswer;
|
||||
|
||||
@Column
|
||||
private boolean isCorrect;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "report_id")
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
private Report report;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "quiz_id")
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
private Quiz quiz;
|
||||
|
||||
}
|
||||
|
@ -46,13 +46,15 @@ public class Report {
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "quizset_id")
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
private QuizSet quizSet;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "reportset_id")
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
private ReportSet reportSet;
|
||||
|
||||
@OneToMany(mappedBy = "report", cascade = CascadeType.REMOVE)
|
||||
@OneToMany(mappedBy = "report")
|
||||
private List<Answer> answers;
|
||||
|
||||
public ReportResponse makeReportResponse() {
|
||||
|
@ -39,7 +39,7 @@ public class ReportSet {
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date createAt;
|
||||
|
||||
@OneToMany(mappedBy = "reportSet", cascade = CascadeType.REMOVE)
|
||||
@OneToMany(mappedBy = "reportSet")
|
||||
private List<Report> reports;
|
||||
|
||||
@ManyToOne
|
||||
@ -49,6 +49,7 @@ public class ReportSet {
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "quizSet_id")
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
private QuizSet quizSet;
|
||||
|
||||
public ReportSetResponse makeReportSetResponse() {
|
||||
|
Loading…
Reference in New Issue
Block a user