1234567891011121314151617181920212223242526 |
- from sqlalchemy import Column, String, Integer, Float, DateTime, ForeignKey
- from .base_model import BaseModel, CreateModel, UpdateModel, DeleteModel
- class ExerciseRecordModel(BaseModel, CreateModel, UpdateModel, DeleteModel):
- """
- 练习记录模型
- 对应数据库表: exercise_records
- """
- __tablename__ = 'exercise_records'
- user_id = Column(Integer,
- ForeignKey('users.id'),
- nullable=False,
- comment='用户ID')
- exercise_id = Column(Integer,
- ForeignKey('exercises.id'),
- nullable=False,
- comment='练习ID')
- start_time = Column(DateTime, nullable=False, comment='开始时间')
- end_time = Column(DateTime, comment='结束时间')
- score = Column(Float, comment='得分')
- status = Column(String(20), nullable=False, comment='状态')
- def __repr__(self):
- return f"<ExerciseRecord(id={self.id}, user_id={self.user_id}, exercise_id={self.exercise_id})>"
|