14 lines
545 B
Python
14 lines
545 B
Python
from sqlalchemy import Column, Integer, String, Boolean, ForeignKey, JSON
|
|
from app.core.database import Base
|
|
|
|
|
|
class ScheduleTask(Base):
|
|
__tablename__ = "schedules"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
device_id = Column(Integer, ForeignKey("devices.id"), nullable=False)
|
|
task_type = Column(String) # 'once', 'daily', 'cron'
|
|
action_params = Column(JSON) # {'state': True, 'dimming': 50}
|
|
is_active = Column(Boolean, default=True)
|
|
job_id = Column(String, unique=True) # ID задачи в APScheduler
|