exam_model.py 966 B

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