Files
ai-contract-platform/backend/app/models/contract_template_version.py
T
yuqei 3df85fdb04 feat: land phase15 legal docs and commercial ops
Includes legal document generation workflows, prompt governance runtime wiring, legal change impact scans, operation KPI dashboards, invoice files, sales follow-up events, mobile review polish, deployment automation, and updated project docs.
2026-05-21 14:42:44 +08:00

30 lines
1.7 KiB
Python

from datetime import datetime, timezone
from typing import Any, Optional
from sqlalchemy import JSON, Boolean, DateTime, ForeignKey, String, Text
from sqlalchemy.orm import Mapped, mapped_column
from app.db import Base
class ContractTemplateVersion(Base):
__tablename__ = "contract_template_versions"
id: Mapped[str] = mapped_column(String(64), primary_key=True)
template_id: Mapped[str] = mapped_column(String(64), ForeignKey("contract_templates.id"), nullable=False, index=True)
tenant_id: Mapped[str] = mapped_column(String(64), nullable=False, index=True)
version_label: Mapped[str] = mapped_column(String(32), nullable=False)
change_summary: Mapped[Optional[str]] = mapped_column(String(500), nullable=True)
name: Mapped[str] = mapped_column(String(100), nullable=False)
contract_type: Mapped[Optional[str]] = mapped_column(String(50), nullable=True)
document_type_code: Mapped[Optional[str]] = mapped_column(String(64), nullable=True, index=True)
template_category: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
industry_category: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
description: Mapped[Optional[str]] = mapped_column(String(500), nullable=True)
content: Mapped[str] = mapped_column(Text, nullable=False)
variables_json: Mapped[Optional[list[dict[str, Any]]]] = mapped_column(JSON, nullable=True)
is_current: Mapped[bool] = mapped_column(Boolean, default=False)
created_by: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
created_by_name: Mapped[Optional[str]] = mapped_column(String(100), nullable=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc))