From 3e509fa9eb2398cebca699c167dbd48d522f3392 Mon Sep 17 00:00:00 2001 From: yulmam <70622601+yulmam@users.noreply.github.com> Date: Fri, 9 Aug 2024 14:45:27 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat=20:=20=EC=B1=84=EC=A0=90=EC=8B=9C=20?= =?UTF-8?q?=EB=8C=80=EC=86=8C=EB=AC=B8=EC=9E=90=20=EC=B2=B4=ED=81=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/edufocus/edufocus/report/service/ReportServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/report/service/ReportServiceImpl.java b/backend/src/main/java/com/edufocus/edufocus/report/service/ReportServiceImpl.java index 33d0a71..5f857da 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/service/ReportServiceImpl.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/service/ReportServiceImpl.java @@ -56,7 +56,7 @@ public class ReportServiceImpl implements ReportService { String inputAnswer = answerInputList.get(idx); boolean isCorrect; Answer answer; - if (quiz.getAnswer().equals(inputAnswer)) { + if (quiz.getAnswer().equalsIgnoreCase(inputAnswer)) { correctCount++; isCorrect = true; } else { From f628bbbd00e166fe9fea6633c194a4be3e371447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A0=95=EB=AF=BC?= Date: Fri, 9 Aug 2024 15:17:28 +0900 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20on=20delete=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/edufocus/edufocus/qna/entity/Qna.java | 4 ++++ .../com/edufocus/edufocus/report/entity/vo/Report.java | 7 +++++-- .../edufocus/edufocus/report/entity/vo/ReportSet.java | 9 ++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/qna/entity/Qna.java b/backend/src/main/java/com/edufocus/edufocus/qna/entity/Qna.java index af797ee..15ea83a 100644 --- a/backend/src/main/java/com/edufocus/edufocus/qna/entity/Qna.java +++ b/backend/src/main/java/com/edufocus/edufocus/qna/entity/Qna.java @@ -4,6 +4,8 @@ import com.edufocus.edufocus.lecture.entity.Lecture; import com.edufocus.edufocus.user.model.entity.vo.User; import jakarta.persistence.*; import lombok.*; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import java.util.Date; @@ -13,6 +15,8 @@ import java.util.Date; @Builder @NoArgsConstructor @AllArgsConstructor + +@OnDelete(action = OnDeleteAction.CASCADE) public class Qna { // 연관관계 주인 diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java index df47ac2..0ac149b 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import jakarta.persistence.*; import lombok.*; import org.hibernate.annotations.CreationTimestamp; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; @@ -22,6 +24,7 @@ import java.util.List; @Builder @EntityListeners(AuditingEntityListener.class) @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +@OnDelete(action = OnDeleteAction.CASCADE) public class Report { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @@ -50,10 +53,10 @@ public class Report { @JoinColumn(name = "reportset_id") private ReportSet reportSet; - @OneToMany(mappedBy = "report", cascade = CascadeType.REMOVE) + @OneToMany(mappedBy = "report", cascade = CascadeType.REMOVE) private List answers; - public ReportResponse makeReportResponse(){ + public ReportResponse makeReportResponse() { return ReportResponse.builder() .reportId(id) .name(user.getName()) diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java index fb293ec..1fd87e1 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java @@ -5,10 +5,9 @@ import com.edufocus.edufocus.quiz.entity.QuizSet; import com.edufocus.edufocus.report.entity.dto.ReportSetResponse; import com.fasterxml.jackson.annotation.JsonAutoDetect; import jakarta.persistence.*; +import jakarta.persistence.CascadeType; import lombok.*; -import org.hibernate.annotations.ColumnDefault; -import org.hibernate.annotations.CreationTimestamp; -import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.*; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; @@ -19,7 +18,6 @@ import java.util.List; import java.util.UUID; - @Entity @Getter @Builder @@ -27,6 +25,7 @@ import java.util.UUID; @AllArgsConstructor @EntityListeners(AuditingEntityListener.class) @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +@OnDelete(action = OnDeleteAction.CASCADE) public class ReportSet { @Id @GeneratedValue(generator = "UUID") @@ -60,7 +59,7 @@ public class ReportSet { .build(); } - public long findUserId(){ + public long findUserId() { return lecture.getUser().getId(); } } From 67153ca7863e0f8bf1e3c074804fcf155d0af090 Mon Sep 17 00:00:00 2001 From: yulmam <70622601+yulmam@users.noreply.github.com> Date: Fri, 9 Aug 2024 15:18:52 +0900 Subject: [PATCH 3/5] =?UTF-8?q?feat=20:=20cascade=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/edufocus/edufocus/board/entity/vo/Board.java | 4 +++- .../com/edufocus/edufocus/report/entity/vo/ReportSet.java | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java index f7ee473..2cca933 100644 --- a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java +++ b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java @@ -9,6 +9,8 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import jakarta.persistence.*; import lombok.*; import org.hibernate.annotations.CreationTimestamp; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import org.hibernate.annotations.UpdateTimestamp; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; @@ -59,9 +61,9 @@ public class Board { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "lecture_id") + @OnDelete(action = OnDeleteAction.CASCADE) private Lecture lecture; - @OneToMany(mappedBy = "board", cascade = CascadeType.ALL) private List comments; diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java index fb293ec..ab10529 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java @@ -5,10 +5,9 @@ import com.edufocus.edufocus.quiz.entity.QuizSet; import com.edufocus.edufocus.report.entity.dto.ReportSetResponse; import com.fasterxml.jackson.annotation.JsonAutoDetect; import jakarta.persistence.*; +import jakarta.persistence.CascadeType; import lombok.*; -import org.hibernate.annotations.ColumnDefault; -import org.hibernate.annotations.CreationTimestamp; -import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.*; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; @@ -46,6 +45,7 @@ public class ReportSet { @ManyToOne @JoinColumn(name = "lecture_id") + @OnDelete(action = OnDeleteAction.CASCADE) private Lecture lecture; @ManyToOne From 00680262a44d8ba84103cef4c0774a6938493dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A0=95=EB=AF=BC?= Date: Fri, 9 Aug 2024 15:27:51 +0900 Subject: [PATCH 4/5] =?UTF-8?q?feat:=20ondelete=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/com/edufocus/edufocus/qna/entity/Qna.java | 2 +- .../java/com/edufocus/edufocus/report/entity/vo/Report.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/qna/entity/Qna.java b/backend/src/main/java/com/edufocus/edufocus/qna/entity/Qna.java index 15ea83a..2325ae2 100644 --- a/backend/src/main/java/com/edufocus/edufocus/qna/entity/Qna.java +++ b/backend/src/main/java/com/edufocus/edufocus/qna/entity/Qna.java @@ -16,7 +16,7 @@ import java.util.Date; @NoArgsConstructor @AllArgsConstructor -@OnDelete(action = OnDeleteAction.CASCADE) + public class Qna { // 연관관계 주인 diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java index 0ac149b..6e5d89a 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/Report.java @@ -24,7 +24,6 @@ import java.util.List; @Builder @EntityListeners(AuditingEntityListener.class) @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) -@OnDelete(action = OnDeleteAction.CASCADE) public class Report { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) From 4cc6cec8f8f3bdcf4feff132fe71b96d5a84b1e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A0=95=EB=AF=BC?= Date: Fri, 9 Aug 2024 15:35:02 +0900 Subject: [PATCH 5/5] =?UTF-8?q?feat:=20casacade=20=EC=B6=94=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/com/edufocus/edufocus/qna/entity/Qna.java | 1 + .../java/com/edufocus/edufocus/report/entity/vo/ReportSet.java | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/qna/entity/Qna.java b/backend/src/main/java/com/edufocus/edufocus/qna/entity/Qna.java index 2325ae2..6216f88 100644 --- a/backend/src/main/java/com/edufocus/edufocus/qna/entity/Qna.java +++ b/backend/src/main/java/com/edufocus/edufocus/qna/entity/Qna.java @@ -54,6 +54,7 @@ public class Qna { @ManyToOne @JoinColumn(name = "lecture_id") + @OnDelete(action = OnDeleteAction.CASCADE) private Lecture lecture; private boolean isMine; diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java index 1fd87e1..b0a245b 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java @@ -25,7 +25,6 @@ import java.util.UUID; @AllArgsConstructor @EntityListeners(AuditingEntityListener.class) @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) -@OnDelete(action = OnDeleteAction.CASCADE) public class ReportSet { @Id @GeneratedValue(generator = "UUID")