exercise_model.py 944 B

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