- 复制来源: /home/yueli/track @ 192c8ee (feature/ai-audit-update) - 组织隔离目标: LICA - 端口规划: 前端 8030 / 后端 8031 / 数据库 8032 - 已排除 deploy.sh、deploy_full.sh、docker-compose.prod.yml(IRIS 生产发布脚本) - 已排除工作区未提交改动,取干净的 192c8ee 状态
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
"""产品协同留言板模型"""
|
|
import uuid
|
|
from datetime import datetime
|
|
from sqlalchemy import String, Text, DateTime, ForeignKey
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.models.base import Base
|
|
from app.core.time_utils import get_beijing_time
|
|
|
|
|
|
class ProductMessage(Base):
|
|
__tablename__ = "product_messages"
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(
|
|
UUID(as_uuid=True), primary_key=True, default=uuid.uuid4,
|
|
)
|
|
product_id: Mapped[uuid.UUID] = mapped_column(
|
|
UUID(as_uuid=True),
|
|
ForeignKey("products.id", ondelete="CASCADE"),
|
|
index=True,
|
|
nullable=False,
|
|
comment="所属产品 ID",
|
|
)
|
|
operator_id: Mapped[str] = mapped_column(
|
|
String(50), nullable=False, comment="留言人姓名或工号",
|
|
)
|
|
content: Mapped[str] = mapped_column(
|
|
Text, nullable=False, comment="留言内容",
|
|
)
|
|
created_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), default=get_beijing_time, comment="留言时间(北京时间)",
|
|
)
|