status_timestamp.py 937 B

1234567891011121314151617181920212223242526272829303132
  1. # -*- coding: utf-8 -*-
  2. from datetime import datetime
  3. from typing import TYPE_CHECKING
  4. from sqlalchemy import Column, DateTime, ForeignKey, Integer, String
  5. from sqlalchemy.orm import relationship
  6. from app.db.session import Base
  7. if TYPE_CHECKING:
  8. from app.models.devices.device import Device
  9. class BlowyFeedbackTime(Base):
  10. __tablename__ = "blowy_feedback_time"
  11. id = Column(Integer, primary_key=True, index=True)
  12. timestamp = Column(DateTime, default=datetime.utcnow())
  13. device_id = Column(String, ForeignKey("devices.id"))
  14. device = relationship("Device", back_populates="blowy_feedback_time")
  15. class HighSpeedTime(Base):
  16. __tablename__ = "high_speed_time"
  17. id = Column(Integer, primary_key=True, index=True)
  18. timestamp = Column(DateTime, default=datetime.utcnow())
  19. device_id = Column(String, ForeignKey("devices.id"))
  20. device = relationship("Device", back_populates="high_speed_time")