"""同行学习圈模型。 AI 匹配面临类似挑战的创始人,结构化讨论。 """ import uuid from datetime import datetime, timezone from sqlalchemy import DateTime, ForeignKey, String, Text from sqlalchemy.orm import Mapped, mapped_column from app.core.database import Base from app.core.types import JSONBType class PeerLearningCircle(Base): """同行学习圈。""" __tablename__ = "peer_learning_circles" id: Mapped[str] = mapped_column(String(36), primary_key=True, default=lambda: str(uuid.uuid4())) tenant_id: Mapped[str] = mapped_column(String(36), ForeignKey("tenants.id"), nullable=False, index=True) topic: Mapped[str] = mapped_column(String(200), nullable=False, comment="讨论话题") description: Mapped[str | None] = mapped_column(Text, nullable=True) members: Mapped[dict | None] = mapped_column(JSONBType, nullable=True, comment="成员列表 — 创始人 ID + 企业 ID") discussion_framework: Mapped[dict | None] = mapped_column(JSONBType, nullable=True, comment="结构化讨论框架") conclusions: Mapped[str | None] = mapped_column(Text, nullable=True, comment="讨论结论") action_commitments: Mapped[dict | None] = mapped_column(JSONBType, nullable=True, comment="行动承诺") status: Mapped[str] = mapped_column(String(20), nullable=False, default="matching", comment="matching/active/completed") 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), )