feat:更新练习题接口
This commit is contained in:
@@ -13,44 +13,12 @@ class LibraryFile(AuditBase):
|
||||
size = Column(Integer, nullable=False)
|
||||
content = Column(Text, nullable=False)
|
||||
|
||||
questions = relationship(
|
||||
"LibraryFileQuestion",
|
||||
back_populates="library_file",
|
||||
cascade="all, delete-orphan"
|
||||
)
|
||||
|
||||
practice_record = relationship(
|
||||
"PracticeRecord",
|
||||
back_populates="library_file",
|
||||
cascade="all, delete-orphan"
|
||||
)
|
||||
|
||||
mistake = relationship(
|
||||
"Mistake",
|
||||
back_populates="library_file",
|
||||
cascade="all, delete-orphan"
|
||||
)
|
||||
|
||||
|
||||
class LibraryFileQuestion(AuditBase):
|
||||
library_file_id = Column(BigInteger, ForeignKey("library_file.id"), nullable=False)
|
||||
|
||||
type = Column(String(45), nullable=False)
|
||||
question = Column(Text, nullable=False)
|
||||
options = Column(JSONB, nullable=False)
|
||||
answer = Column(JSONB, nullable=False)
|
||||
|
||||
library_file = relationship(
|
||||
"LibraryFile",
|
||||
back_populates="questions"
|
||||
)
|
||||
|
||||
mistake = relationship(
|
||||
"Mistake",
|
||||
back_populates="library_file_question",
|
||||
cascade="all, delete-orphan"
|
||||
)
|
||||
|
||||
|
||||
class PracticeRecord(AuditBase):
|
||||
library_file_id = Column(BigInteger, ForeignKey("library_file.id"), nullable=False)
|
||||
@@ -64,18 +32,12 @@ class PracticeRecord(AuditBase):
|
||||
back_populates="practice_record",
|
||||
)
|
||||
|
||||
|
||||
class Mistake(AuditBase):
|
||||
library_file_id = Column(BigInteger, ForeignKey("library_file.id"), nullable=False)
|
||||
question_id = Column(BigInteger, ForeignKey("library_file_question.id"), nullable=False)
|
||||
|
||||
wrong_count = Column(Integer, nullable=False)
|
||||
|
||||
library_file = relationship(
|
||||
"LibraryFile",
|
||||
back_populates="mistake",
|
||||
)
|
||||
|
||||
library_file_question = relationship(
|
||||
"LibraryFileQuestion",
|
||||
back_populates="mistake",
|
||||
)
|
||||
subject = Column(String(45), nullable=False)
|
||||
module = Column(String(45), nullable=False)
|
||||
name = Column(String(45), nullable=False)
|
||||
type = Column(String(45), nullable=False)
|
||||
question = Column(Text, nullable=False)
|
||||
options = Column(JSONB, nullable=False)
|
||||
answer = Column(JSONB, nullable=False)
|
||||
|
||||
Reference in New Issue
Block a user