chore: initial baseline with P0-safety .gitignore

This commit is contained in:
Simon
2026-06-14 16:49:18 +08:00
commit 63262292d7
510 changed files with 146008 additions and 0 deletions
+104
View File
@@ -0,0 +1,104 @@
# =============================================================================
# 企微IT智能服务台 — 审批流程链接模型
# =============================================================================
# 说明:对应数据库 approval_links 表,存储审批流程的外部链接
# 分类:IT/HR/行政/财务
# 在H5用户端右侧AI助手面板中展示,方便员工快速访问审批页面
# =============================================================================
import uuid
from datetime import datetime
from sqlalchemy import DateTime, Index, Integer, String, Text
from sqlalchemy.orm import Mapped, mapped_column
from app.database import Base
class ApprovalLink(Base):
"""审批流程链接模型 — 对应 approval_links 表。
存储公司各类审批流程的外部链接,
在H5用户端AI助手面板中按分类展示。
Attributes:
id: 链接唯一标识(UUID,数据库自动生成)
category: 分类(IT/HR/行政/财务)
title: 审批名称
url: 审批链接
sort_order: 排序权重
created_at: 创建时间
updated_at: 更新时间
"""
# 表名(必须和架构文档 DDL 一致)
__tablename__ = "approval_links"
# --------------------------------------------------------------------------
# 字段定义
# --------------------------------------------------------------------------
# 主键:UUIDPython端生成(兼容PostgreSQL和SQLite
id: Mapped[str] = mapped_column(
String(36),
primary_key=True,
default=lambda: str(uuid.uuid4()),
)
# 分类(按部门分类,方便在H5面板中折叠展示)
category: Mapped[str] = mapped_column(
String(64),
nullable=False,
comment="分类:IT/HR/行政/财务",
)
# 审批名称(展示给用户看的标题)
title: Mapped[str] = mapped_column(
String(128),
nullable=False,
comment="审批名称",
)
# 审批链接(点击后跳转到对应的审批页面)
url: Mapped[str] = mapped_column(
Text,
nullable=False,
comment="审批链接",
)
# 排序权重(同一分类内排序,数值越小越靠前)
sort_order: Mapped[int] = mapped_column(
Integer,
nullable=False,
default=0,
comment="排序权重",
)
# 创建时间
created_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True),
nullable=False,
default=datetime.now,
comment="创建时间",
)
# 更新时间
updated_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True),
nullable=False,
default=datetime.now,
onupdate=datetime.now,
comment="更新时间",
)
# --------------------------------------------------------------------------
# 索引定义(和架构文档 DDL 严格一致)
# --------------------------------------------------------------------------
__table_args__ = (
# 按分类查询(如获取所有"IT"分类的审批链接)
Index("idx_al_category", "category"),
)
def __repr__(self) -> str:
"""链接对象的字符串表示,方便调试。"""
return f"<ApprovalLink(id={self.id}, category={self.category}, title={self.title})>"