Files
ai-contract-platform/backend/app/models/pilot_request.py
T

34 lines
1.8 KiB
Python

from datetime import datetime, timezone
from typing import Optional
from sqlalchemy import DateTime, Text, String
from sqlalchemy.orm import Mapped, mapped_column
from app.db import Base
class PilotRequest(Base):
__tablename__ = "pilot_requests"
id: Mapped[str] = mapped_column(String(64), primary_key=True)
tenant_id: Mapped[str] = mapped_column(String(64), nullable=False, index=True)
contact_name: Mapped[str] = mapped_column(String(100), nullable=False)
company_name: Mapped[str] = mapped_column(String(160), nullable=False, index=True)
role_title: Mapped[Optional[str]] = mapped_column(String(120), nullable=True)
email: Mapped[str] = mapped_column(String(160), nullable=False, index=True)
phone: Mapped[Optional[str]] = mapped_column(String(40), nullable=True)
expected_contract_volume: Mapped[Optional[str]] = mapped_column(String(80), nullable=True)
primary_goal: Mapped[str] = mapped_column(String(80), nullable=False)
deployment_preference: Mapped[Optional[str]] = mapped_column(String(40), nullable=True)
scenario_description: Mapped[str] = mapped_column(Text, nullable=False)
status: Mapped[str] = mapped_column(String(32), default="new", nullable=False, index=True)
source: Mapped[str] = mapped_column(String(32), default="website", nullable=False)
admin_notes: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
last_contact_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),
)