42 lines
2.0 KiB
Python
42 lines
2.0 KiB
Python
"""ORM model for TaskCOP compatibility tasks."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import UTC, datetime
|
|
|
|
from sqlalchemy import Integer, String
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from deerflow.persistence.base import Base
|
|
from deerflow.persistence.types import BeijingDateTime, PortableLongText
|
|
|
|
|
|
class TaskCopTaskRow(Base):
|
|
"""A task created from the legacy situation-overview screen."""
|
|
|
|
__tablename__ = "taskcop_tasks"
|
|
|
|
id: Mapped[str] = mapped_column(String(64), primary_key=True)
|
|
task_name: Mapped[str] = mapped_column(String(512), nullable=False, index=True)
|
|
overview: Mapped[str] = mapped_column(PortableLongText, nullable=False, default="")
|
|
task_level: Mapped[str] = mapped_column(String(32), nullable=False, default="1")
|
|
task_direction: Mapped[str] = mapped_column(String(64), nullable=False, default="W方向", index=True)
|
|
task_status: Mapped[int] = mapped_column(Integer, nullable=False, default=0, index=True)
|
|
task_type: Mapped[int] = mapped_column(Integer, nullable=False, default=1)
|
|
task_superior_flag: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
|
parent_task_id: Mapped[str | None] = mapped_column(String(64), nullable=True, index=True)
|
|
issuing_dept: Mapped[str] = mapped_column(String(255), nullable=False, default="")
|
|
task_no: Mapped[str] = mapped_column(String(255), nullable=False, default="")
|
|
created_by: Mapped[str] = mapped_column(String(64), nullable=False, default="default", index=True)
|
|
task_start_date: Mapped[datetime | None] = mapped_column(BeijingDateTime(), nullable=True)
|
|
task_end_date: Mapped[datetime | None] = mapped_column(BeijingDateTime(), nullable=True)
|
|
create_time: Mapped[datetime] = mapped_column(
|
|
BeijingDateTime(), nullable=False, default=lambda: datetime.now(UTC), index=True
|
|
)
|
|
update_time: Mapped[datetime] = mapped_column(
|
|
BeijingDateTime(),
|
|
nullable=False,
|
|
default=lambda: datetime.now(UTC),
|
|
onupdate=lambda: datetime.now(UTC),
|
|
)
|