You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
1.2 KiB
Python

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

from sqlalchemy import JSON, Integer, String, Text, UniqueConstraint
from sqlalchemy.orm import Mapped, mapped_column
from app.core.base_model import ModelMixin, TenantMixin, UserMixin
class WorkflowModel(ModelMixin, TenantMixin, UserMixin):
"""
工作流定义Vue Flow 画布序列化 + 拓扑分层并行执行
"""
__tablename__: str = "task_workflow"
__table_args__ = (
UniqueConstraint("tenant_id", "code", name="uq_task_workflow_code"),
{"comment": "工作流定义表"},
)
__loader_options__: list[str] = ["created_by", "updated_by", "deleted_by", "tenant_by"]
name: Mapped[str] = mapped_column(String(128), nullable=False, comment="流程名称")
code: Mapped[str] = mapped_column(String(64), nullable=False, comment="流程编码")
nodes: Mapped[list | None] = mapped_column(JSON, nullable=True, comment="VueFlow节点")
edges: Mapped[list | None] = mapped_column(JSON, nullable=True, comment="VueFlow连接线")
status: Mapped[int] = mapped_column(Integer, default=0, nullable=False, comment="状态(0:草稿 1:已发布 2:已归档)", index=True)
description: Mapped[str | None] = mapped_column(Text, default=None, nullable=True, comment="备注")