```
refactor(core,ai): 调整模块导入路径并移除废弃文件 - 修复 scheduler.py 中的导入路径错误,将 reports.service 改为 reports.services - 移除废弃的 app/core/background/task_queue.py 文件 - 移除废弃的 app/modules/ai_agent/adapters.py 文件 - 修复 ai_memory/service.py 中的导入路径错误,将 events.service 改为 events.services ```
This commit is contained in:
54
app/modules/business/models/governance.py
Normal file
54
app/modules/business/models/governance.py
Normal file
@@ -0,0 +1,54 @@
|
||||
from datetime import date
|
||||
from decimal import Decimal
|
||||
|
||||
from sqlalchemy import Date, Integer, Numeric, String, Text
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.core.database import Base
|
||||
from app.modules.business.constants import (
|
||||
StatusValue,
|
||||
VersionValue,
|
||||
)
|
||||
from app.modules.business.models.common import TimestampMixin
|
||||
|
||||
|
||||
class Policy(Base, TimestampMixin):
|
||||
__tablename__ = "policies"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
code: Mapped[str] = mapped_column(String(64), unique=True, index=True)
|
||||
title: Mapped[str] = mapped_column(String(255), index=True)
|
||||
policy_type: Mapped[str | None] = mapped_column(String(128), nullable=True)
|
||||
owner_department: Mapped[str | None] = mapped_column(String(128), nullable=True)
|
||||
version: Mapped[str] = mapped_column(String(32), default=VersionValue.V1_0)
|
||||
status: Mapped[str] = mapped_column(String(64), default=StatusValue.POLICY_DRAFT, index=True)
|
||||
effective_date: Mapped[date | None] = mapped_column(Date, nullable=True)
|
||||
feishu_doc_url: Mapped[str | None] = mapped_column(String(1024), nullable=True)
|
||||
summary: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
|
||||
class Standard(Base, TimestampMixin):
|
||||
__tablename__ = "standards"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
code: Mapped[str] = mapped_column(String(64), unique=True, index=True)
|
||||
title: Mapped[str] = mapped_column(String(255), index=True)
|
||||
standard_type: Mapped[str | None] = mapped_column(String(128), nullable=True)
|
||||
applies_to: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
||||
status: Mapped[str] = mapped_column(String(64), default=StatusValue.VALID, index=True)
|
||||
check_items: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
remediation: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
policy_code: Mapped[str | None] = mapped_column(String(64), nullable=True, index=True)
|
||||
|
||||
class PerformanceMetric(Base, TimestampMixin):
|
||||
__tablename__ = "performance_metrics"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
code: Mapped[str] = mapped_column(String(64), unique=True, index=True)
|
||||
name: Mapped[str] = mapped_column(String(255), index=True)
|
||||
applies_to_role: Mapped[str | None] = mapped_column(String(128), nullable=True)
|
||||
formula: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
weight: Mapped[Decimal] = mapped_column(Numeric(5, 2), default=0)
|
||||
data_source: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
||||
auto_score: Mapped[Decimal] = mapped_column(Numeric(8, 2), default=0)
|
||||
confirmed_score: Mapped[Decimal | None] = mapped_column(Numeric(8, 2), nullable=True)
|
||||
status: Mapped[str] = mapped_column(String(64), default=StatusValue.DRAFT, index=True)
|
||||
Reference in New Issue
Block a user