diff --git a/src/main/java/com/m9d/sroom/common/entity/jpa/ChapterEntity.java b/src/main/java/com/m9d/sroom/common/entity/jpa/ChapterEntity.java index 236f2343..59cbccc7 100644 --- a/src/main/java/com/m9d/sroom/common/entity/jpa/ChapterEntity.java +++ b/src/main/java/com/m9d/sroom/common/entity/jpa/ChapterEntity.java @@ -13,16 +13,14 @@ public class ChapterEntity { private Long chapterId; @ManyToOne - @JoinColumn(name = "video_id", nullable = false) + @JoinColumn(name = "video_id") private VideoEntity video; - @Column(nullable = false) private int startTime; - @Column(nullable = false) private int duration; @OneToOne - @JoinColumn(name = "summary_id", nullable = false) + @JoinColumn(name = "summary_id") private SummaryEntity summary; } diff --git a/src/main/java/com/m9d/sroom/common/entity/jpa/LectureEntity.java b/src/main/java/com/m9d/sroom/common/entity/jpa/LectureEntity.java index 01c6f437..46d53975 100644 --- a/src/main/java/com/m9d/sroom/common/entity/jpa/LectureEntity.java +++ b/src/main/java/com/m9d/sroom/common/entity/jpa/LectureEntity.java @@ -13,28 +13,21 @@ public class LectureEntity { private Long lectureId; @ManyToOne - @JoinColumn(name = "member_id", nullable = false) + @JoinColumn(name = "member_id") private MemberEntity member; @ManyToOne - @JoinColumn(name = "course_id", nullable = false) + @JoinColumn(name = "course_id") private CourseEntity course; //source_id의 경우 두 테이블(video, playlist) 모두 매핑되어야 하는데 이게 불가능해서 따로 연관관계를 설정하지 않았습니다. - @Column(nullable = true) private Long sourceId; - @Column(nullable = false) private Boolean playlist; - @Column(nullable = false) - @ColumnDefault("0") private Integer lectureIndex; - @Column(nullable = false) - @ColumnDefault("false") private Boolean reviewed; - @Column(nullable = false) private String channel; } diff --git a/src/main/java/com/m9d/sroom/common/entity/jpa/PlaylistEntity.java b/src/main/java/com/m9d/sroom/common/entity/jpa/PlaylistEntity.java index 23eee81a..128e7c53 100644 --- a/src/main/java/com/m9d/sroom/common/entity/jpa/PlaylistEntity.java +++ b/src/main/java/com/m9d/sroom/common/entity/jpa/PlaylistEntity.java @@ -6,6 +6,8 @@ import javax.persistence.*; import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; @Entity @Table(name="PLAYLIST") @@ -15,48 +17,31 @@ public class PlaylistEntity { @GeneratedValue(strategy = GenerationType.AUTO) private Long playlistId; - @Column(nullable = false, unique = true) private String playlistCode; - @Column(nullable = false) private String channel; - @Column(nullable = false) private String title; - @Column(nullable = true) private Integer duration; - @Column(nullable = true) private String description; - @Column(nullable = false) private Timestamp publishedAt; - @Column(nullable = false) private Integer videoCount; - @Column(nullable = false) - @ColumnDefault("0") private Integer accumulatedRating; - @Column(nullable = true) - @ColumnDefault("false") private Boolean available; - @Column(nullable = false) - @ColumnDefault("0") private Integer reviewCount; - @Column(nullable = false) private String thumbnail; - @Column(nullable = false) @CreationTimestamp @UpdateTimestamp private Timestamp updatedAt; - @Column(nullable = false) - @ColumnDefault("0") private Float averageRating; } diff --git a/src/main/java/com/m9d/sroom/common/entity/jpa/PlaylistVideoEntity.java b/src/main/java/com/m9d/sroom/common/entity/jpa/PlaylistVideoEntity.java index 6e9ff2eb..f0202b2e 100644 --- a/src/main/java/com/m9d/sroom/common/entity/jpa/PlaylistVideoEntity.java +++ b/src/main/java/com/m9d/sroom/common/entity/jpa/PlaylistVideoEntity.java @@ -11,13 +11,12 @@ public class PlaylistVideoEntity { private Long playlistVideoId; @ManyToOne - @JoinColumn(name = "playlist_id", nullable = false) + @JoinColumn(name = "playlist_id") private PlaylistEntity playlist; @ManyToOne - @JoinColumn(name = "video_id", nullable = false) + @JoinColumn(name = "video_id") private VideoEntity video; - @Column(nullable = false) private Integer videoIndex; } diff --git a/src/main/java/com/m9d/sroom/common/entity/jpa/QuizEntity.java b/src/main/java/com/m9d/sroom/common/entity/jpa/QuizEntity.java index 775ee2b6..40b36b78 100644 --- a/src/main/java/com/m9d/sroom/common/entity/jpa/QuizEntity.java +++ b/src/main/java/com/m9d/sroom/common/entity/jpa/QuizEntity.java @@ -14,26 +14,18 @@ public class QuizEntity { private Long quizId; @ManyToOne - @JoinColumn(name = "video_id", nullable = false) + @JoinColumn(name = "video_id") private VideoEntity video; - @Column(nullable = false) private int type; - @Column(nullable = false) private String question; - @Column(nullable = true) private String subjectiveAnswer; - @Column(nullable = true) private Integer choiceAnswer; - @Column(nullable = false) - @ColumnDefault("0") private Integer positiveFeedbackCount; - @Column(nullable = false) - @ColumnDefault("0") - private Integer negativeFeedbackCount; + private Integer negativeFeedbackCount; } diff --git a/src/main/java/com/m9d/sroom/common/entity/jpa/QuizOptionEntity.java b/src/main/java/com/m9d/sroom/common/entity/jpa/QuizOptionEntity.java index 3e9ae21b..7760cde1 100644 --- a/src/main/java/com/m9d/sroom/common/entity/jpa/QuizOptionEntity.java +++ b/src/main/java/com/m9d/sroom/common/entity/jpa/QuizOptionEntity.java @@ -12,13 +12,10 @@ public class QuizOptionEntity { @ManyToOne - @JoinColumn(name = "quiz_id", nullable = false) + @JoinColumn(name = "quiz_id") private QuizEntity quiz; - - @Column(nullable = false) private String optionText; - @Column(nullable = false) private int optionIndex; } diff --git a/src/main/java/com/m9d/sroom/common/entity/jpa/SummaryEntity.java b/src/main/java/com/m9d/sroom/common/entity/jpa/SummaryEntity.java index 6e51a97a..0acb7089 100644 --- a/src/main/java/com/m9d/sroom/common/entity/jpa/SummaryEntity.java +++ b/src/main/java/com/m9d/sroom/common/entity/jpa/SummaryEntity.java @@ -16,26 +16,18 @@ public class SummaryEntity { private Long summaryId; @OneToOne - @JoinColumn(name = "video_id", nullable = false) + @JoinColumn(name = "video_id") private VideoEntity video; - @Column(nullable = false) private String content; - @Column(nullable = false) @CreationTimestamp @UpdateTimestamp private Timestamp updatedAt; - @Column(nullable = false) - @ColumnDefault("false") private boolean modified; - @Column(nullable = false) - @ColumnDefault("0") private Integer positiveFeedbackCount; - @Column(nullable = false) - @ColumnDefault("0") private Integer negativeFeedbackCount; } diff --git a/src/main/java/com/m9d/sroom/common/entity/jpa/VideoEntity.java b/src/main/java/com/m9d/sroom/common/entity/jpa/VideoEntity.java index 4fe65185..bc2c7fd9 100644 --- a/src/main/java/com/m9d/sroom/common/entity/jpa/VideoEntity.java +++ b/src/main/java/com/m9d/sroom/common/entity/jpa/VideoEntity.java @@ -15,73 +15,47 @@ public class VideoEntity { @GeneratedValue(strategy = GenerationType.AUTO) private Long videoId; - @Column(nullable = false, unique = true) private String videoCode; - @Column(nullable = false) private String title; - @Column(nullable = false) private String channel; - @Column(nullable = true) private String description; - @Column(nullable = false) private int duration; - @Column(nullable = false) private boolean playlist; - @Column(nullable = true) private Long viewCount; - @Column(nullable = false) private Timestamp publishedAt; - @Column(nullable = false) - @ColumnDefault("0") private int accumulatedRating; - @Column(nullable = false) - @ColumnDefault("0") private int reviewCount; - @Column(nullable = false) private String thumbnail; - @Column(nullable = true) private String language; - @Column(nullable = false) private String license; - @Column(nullable = false) @CreationTimestamp @UpdateTimestamp private Timestamp updatedAt; - @Column(nullable = false) - @ColumnDefault("0") private boolean membership; @OneToOne - @JoinColumn(name = "summary_id", nullable = true) + @JoinColumn(name = "summary_id") private SummaryEntity summary; - @Column(nullable = false) - @ColumnDefault("1") private boolean available; - @Column(nullable = true) - @ColumnDefault("0") private boolean chapterUse; - @Column(nullable = false) - @ColumnDefault("-2") private Integer materialStatus; - @Column(nullable = false) - @ColumnDefault("0") private Float averageRating; }