Merge branch 'backend' of https://lab.ssafy.com/s11-webmobile1-sub2/S11P12A701 into be/registration
This commit is contained in:
commit
fc18137c54
@ -9,6 +9,8 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
|||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import org.hibernate.annotations.CreationTimestamp;
|
import org.hibernate.annotations.CreationTimestamp;
|
||||||
|
import org.hibernate.annotations.OnDelete;
|
||||||
|
import org.hibernate.annotations.OnDeleteAction;
|
||||||
import org.hibernate.annotations.UpdateTimestamp;
|
import org.hibernate.annotations.UpdateTimestamp;
|
||||||
import org.springframework.data.annotation.CreatedDate;
|
import org.springframework.data.annotation.CreatedDate;
|
||||||
import org.springframework.data.annotation.LastModifiedDate;
|
import org.springframework.data.annotation.LastModifiedDate;
|
||||||
@ -59,9 +61,9 @@ public class Board {
|
|||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "lecture_id")
|
@JoinColumn(name = "lecture_id")
|
||||||
|
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||||
private Lecture lecture;
|
private Lecture lecture;
|
||||||
|
|
||||||
|
|
||||||
@OneToMany(mappedBy = "board", cascade = CascadeType.ALL)
|
@OneToMany(mappedBy = "board", cascade = CascadeType.ALL)
|
||||||
private List<Comment> comments;
|
private List<Comment> comments;
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ import com.edufocus.edufocus.lecture.entity.Lecture;
|
|||||||
import com.edufocus.edufocus.user.model.entity.vo.User;
|
import com.edufocus.edufocus.user.model.entity.vo.User;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
import org.hibernate.annotations.OnDelete;
|
||||||
|
import org.hibernate.annotations.OnDeleteAction;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@ -13,6 +15,8 @@ import java.util.Date;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
|
||||||
|
|
||||||
public class Qna {
|
public class Qna {
|
||||||
|
|
||||||
// 연관관계 주인
|
// 연관관계 주인
|
||||||
@ -50,6 +54,7 @@ public class Qna {
|
|||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "lecture_id")
|
@JoinColumn(name = "lecture_id")
|
||||||
|
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||||
private Lecture lecture;
|
private Lecture lecture;
|
||||||
|
|
||||||
private boolean isMine;
|
private boolean isMine;
|
||||||
|
@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
|||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import org.hibernate.annotations.CreationTimestamp;
|
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.annotation.CreatedDate;
|
||||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
@ -50,10 +52,10 @@ public class Report {
|
|||||||
@JoinColumn(name = "reportset_id")
|
@JoinColumn(name = "reportset_id")
|
||||||
private ReportSet reportSet;
|
private ReportSet reportSet;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "report", cascade = CascadeType.REMOVE)
|
@OneToMany(mappedBy = "report", cascade = CascadeType.REMOVE)
|
||||||
private List<Answer> answers;
|
private List<Answer> answers;
|
||||||
|
|
||||||
public ReportResponse makeReportResponse(){
|
public ReportResponse makeReportResponse() {
|
||||||
return ReportResponse.builder()
|
return ReportResponse.builder()
|
||||||
.reportId(id)
|
.reportId(id)
|
||||||
.name(user.getName())
|
.name(user.getName())
|
||||||
|
@ -5,10 +5,9 @@ import com.edufocus.edufocus.quiz.entity.QuizSet;
|
|||||||
import com.edufocus.edufocus.report.entity.dto.ReportSetResponse;
|
import com.edufocus.edufocus.report.entity.dto.ReportSetResponse;
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import org.hibernate.annotations.ColumnDefault;
|
import org.hibernate.annotations.*;
|
||||||
import org.hibernate.annotations.CreationTimestamp;
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
import org.springframework.data.annotation.CreatedDate;
|
import org.springframework.data.annotation.CreatedDate;
|
||||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
@ -19,7 +18,6 @@ import java.util.List;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Getter
|
@Getter
|
||||||
@Builder
|
@Builder
|
||||||
@ -46,6 +44,7 @@ public class ReportSet {
|
|||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "lecture_id")
|
@JoinColumn(name = "lecture_id")
|
||||||
|
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||||
private Lecture lecture;
|
private Lecture lecture;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@ -60,7 +59,7 @@ public class ReportSet {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long findUserId(){
|
public long findUserId() {
|
||||||
return lecture.getUser().getId();
|
return lecture.getUser().getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
String inputAnswer = answerInputList.get(idx);
|
String inputAnswer = answerInputList.get(idx);
|
||||||
boolean isCorrect;
|
boolean isCorrect;
|
||||||
Answer answer;
|
Answer answer;
|
||||||
if (quiz.getAnswer().equals(inputAnswer)) {
|
if (quiz.getAnswer().equalsIgnoreCase(inputAnswer)) {
|
||||||
correctCount++;
|
correctCount++;
|
||||||
isCorrect = true;
|
isCorrect = true;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user