```
feat: 添加仪表板路由和响应数据脱敏功能 - 添加了仪表板模块路由并集成到主路由器中 - 实现了敏感数据响应脱敏配置和功能 - 增加了 Feishu 审批卡片操作处理功能 - 支持通过任务队列异步推送日常简报和项目周报 - 添加了风险事件生成的任务队列支持 - 在 smoke 测试中增加了相关功能验证 refactor: 格式化模型注册模块导入列表 - 将单行导入列表改为多行格式以提高可读性 ```
This commit is contained in:
@@ -3,6 +3,7 @@ from fastapi import status as http_status
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.core.database import get_db
|
||||
from app.core.masking import mask_configured
|
||||
from app.core.security import ApiPrincipal, require_api_key
|
||||
from app.modules.business.constants import BusinessField, BusinessResponseKey
|
||||
from app.modules.business.registry import supported_domain_values
|
||||
@@ -32,16 +33,22 @@ def list_records(
|
||||
return {
|
||||
BusinessResponseKey.DOMAIN: domain,
|
||||
BusinessResponseKey.TOTAL: total,
|
||||
BusinessResponseKey.ITEMS: items,
|
||||
BusinessResponseKey.ITEMS: mask_configured(items),
|
||||
}
|
||||
|
||||
|
||||
@router.get("/{domain}/{record_id}")
|
||||
def get_record(domain: str, record_id: int, db: Session = Depends(get_db)) -> dict:
|
||||
def get_record(
|
||||
domain: str,
|
||||
record_id: int,
|
||||
db: Session = Depends(get_db),
|
||||
) -> dict:
|
||||
try:
|
||||
return {
|
||||
BusinessResponseKey.DOMAIN: domain,
|
||||
BusinessResponseKey.DATA: BusinessService(db).get_record(domain, record_id),
|
||||
BusinessResponseKey.DATA: mask_configured(
|
||||
BusinessService(db).get_record(domain, record_id)
|
||||
),
|
||||
}
|
||||
except KeyError as exc:
|
||||
raise HTTPException(status_code=http_status.HTTP_404_NOT_FOUND, detail=str(exc)) from exc
|
||||
@@ -63,7 +70,10 @@ def create_record(
|
||||
)
|
||||
except KeyError as exc:
|
||||
raise HTTPException(status_code=http_status.HTTP_404_NOT_FOUND, detail=str(exc)) from exc
|
||||
return {BusinessResponseKey.DOMAIN: domain, BusinessResponseKey.DATA: data}
|
||||
return {
|
||||
BusinessResponseKey.DOMAIN: domain,
|
||||
BusinessResponseKey.DATA: mask_configured(data),
|
||||
}
|
||||
|
||||
|
||||
@router.patch("/{domain}/{record_id}")
|
||||
@@ -84,4 +94,7 @@ def update_record(
|
||||
)
|
||||
except KeyError as exc:
|
||||
raise HTTPException(status_code=http_status.HTTP_404_NOT_FOUND, detail=str(exc)) from exc
|
||||
return {BusinessResponseKey.DOMAIN: domain, BusinessResponseKey.DATA: data}
|
||||
return {
|
||||
BusinessResponseKey.DOMAIN: domain,
|
||||
BusinessResponseKey.DATA: mask_configured(data),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user