12345678910111213141516171819202122 |
- from sqlalchemy import Column, Integer, String, DateTime
- from .base_model import BaseModel, CreateModel, UpdateModel, DeleteModel
- class ExerciseModel(BaseModel, CreateModel, UpdateModel, DeleteModel):
- """
- 练习模型
- 对应数据库表: exercises
- """
- __tablename__ = 'exercises'
- name = Column(String(100), nullable=False, comment='练习名称')
- description = Column(String(500), comment='练习描述')
- subject = Column(String(50), nullable=False, comment='所属学科')
- total_questions = Column(Integer, nullable=False, comment='题目总数')
- duration = Column(Integer, comment='练习时长(分钟)')
- start_time = Column(DateTime, comment='开始时间')
- end_time = Column(DateTime, comment='结束时间')
- status = Column(String(20), nullable=False, comment='状态')
- def __repr__(self):
- return f"<Exercise(id={self.id}, name={self.name}, subject={self.subject})>"
|