forked from kookmin-sw/cap-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
backend/src/main/java/com/project/capstone/quiz/domain/Quiz.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.project.capstone.quiz.domain; | ||
|
||
import com.project.capstone.book.domain.Book; | ||
import com.project.capstone.club.domain.Club; | ||
import com.project.capstone.member.domain.Member; | ||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
@Entity | ||
@EntityListeners(AuditingEntityListener.class) | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
public class Quiz { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
private QuizType type; | ||
private String description; | ||
private String answer; | ||
private String example1; | ||
private String example2; | ||
private String example3; | ||
private String example4; | ||
|
||
@ManyToOne | ||
private Member member; | ||
|
||
@ManyToOne | ||
private Book book; | ||
|
||
@ManyToOne | ||
private Club club; | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
backend/src/main/java/com/project/capstone/quiz/domain/QuizType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.project.capstone.quiz.domain; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.project.capstone.club.domain.PublicStatus; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@AllArgsConstructor | ||
@Getter | ||
public enum QuizType { | ||
Multiple_Choice("객관식"), | ||
Short_Answer("단답식"), | ||
OX("OX") | ||
; | ||
|
||
private final String type; | ||
|
||
@JsonCreator | ||
public static QuizType from(String type) { | ||
for (QuizType quizType : QuizType.values()) { | ||
if (quizType.getType().equals(type)) { | ||
return quizType; | ||
} | ||
} | ||
throw new RuntimeException("잘못된 퀴즈 타입 입니다."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters