Files
aiagent/backend/app/models/company_schedule.py
renjianbo f2e65a8fbb feat: virtual company module, team projects, PWA dishes app, and startup scripts overhaul
- Add company module (3-tier org, CEO planning, parallel departments)
- Add company orchestrator, knowledge extractor, presets, scheduler
- Add company API endpoints, models, and frontend views
- Add 今天吃啥 PWA app (69 dishes, real images, offline support)
- Add team_projects output directory structure
- Add unified manage.ps1 for service lifecycle
- Add Windows startup guide v1.0
- Add TTS troubleshooting doc
- Update frontend (AgentChat UX overhaul, new views)
- Update backend (voice engine fix, multi-tenant, RBAC)
- Remove deprecated startup scripts and old docs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-10 22:37:56 +08:00

43 lines
2.0 KiB
Python

"""
公司定时调度模型 — 周期性自动执行公司项目
"""
from sqlalchemy import Column, String, Text, Boolean, DateTime, ForeignKey, func
from sqlalchemy.dialects.mysql import CHAR
from app.core.database import Base
import uuid
class CompanySchedule(Base):
"""公司定时调度表"""
__tablename__ = "company_schedules"
id = Column(CHAR(36), primary_key=True, default=lambda: str(uuid.uuid4()), comment="调度ID")
company_id = Column(CHAR(36), ForeignKey("companies.id"), nullable=False, comment="所属公司ID")
name = Column(String(200), nullable=False, comment="调度名称")
project_goal = Column(Text, nullable=False, comment="项目目标描述")
cron_expression = Column(String(100), nullable=True, comment="Cron表达式")
interval_minutes = Column(String(20), nullable=True, comment="间隔分钟数(备用)")
enabled = Column(Boolean, default=True, comment="是否启用")
last_run_at = Column(DateTime, nullable=True, comment="上次执行时间")
next_run_at = Column(DateTime, nullable=True, comment="下次执行时间")
created_at = Column(DateTime, default=func.now(), comment="创建时间")
updated_at = Column(DateTime, default=func.now(), onupdate=func.now(), comment="更新时间")
def __repr__(self):
return f"<CompanySchedule(id={self.id}, name={self.name}, company={self.company_id})>"
def to_dict(self):
return {
"id": self.id,
"company_id": self.company_id,
"name": self.name,
"project_goal": self.project_goal,
"cron_expression": self.cron_expression,
"interval_minutes": self.interval_minutes,
"enabled": self.enabled,
"last_run_at": self.last_run_at.isoformat() if self.last_run_at else None,
"next_run_at": self.next_run_at.isoformat() if self.next_run_at else None,
"created_at": self.created_at.isoformat() if self.created_at else None,
"updated_at": self.updated_at.isoformat() if self.updated_at else None,
}