Files
ai-contract-platform/backend/app/models/legal_document_draft.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

33 lines
1.8 KiB
Python

from datetime import datetime, timezone
from typing import Any, Optional
from sqlalchemy import JSON, DateTime, String
from sqlalchemy.orm import Mapped, mapped_column
from app.db import Base
class LegalDocumentDraft(Base):
__tablename__ = "legal_document_drafts"
id: Mapped[str] = mapped_column(String(64), primary_key=True)
tenant_id: Mapped[str] = mapped_column(String(64), nullable=False, index=True)
user_id: Mapped[str] = mapped_column(String(64), nullable=False, index=True)
document_type_code: Mapped[str] = mapped_column(String(64), nullable=False, index=True)
title: Mapped[Optional[str]] = mapped_column(String(200), nullable=True)
status: Mapped[str] = mapped_column(String(32), nullable=False, default="draft", index=True)
element_values_json: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False, default=dict)
validation_result_json: Mapped[Optional[dict[str, Any]]] = mapped_column(JSON, nullable=True)
element_schema_id: Mapped[Optional[str]] = mapped_column(String(64), nullable=True, index=True)
element_schema_version_label: Mapped[Optional[str]] = mapped_column(String(32), nullable=True)
template_id: Mapped[Optional[str]] = mapped_column(String(64), nullable=True, index=True)
generated_contract_id: Mapped[Optional[str]] = mapped_column(String(64), nullable=True, index=True)
submitted_at: Mapped[Optional[datetime]] = mapped_column(DateTime(timezone=True), nullable=True)
deleted_at: Mapped[Optional[datetime]] = mapped_column(DateTime(timezone=True), nullable=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc))
updated_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True),
default=lambda: datetime.now(timezone.utc),
onupdate=lambda: datetime.now(timezone.utc),
)