Step 12:后端轻量优化(API 稳定性 & 前端友好)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
from app.constants import ae, finance, imp, issue, subject, task
|
||||
from app.core.deps import get_current_user
|
||||
|
||||
router = APIRouter(tags=["FAQ"], dependencies=[Depends(get_current_user)])
|
||||
|
||||
|
||||
@router.get(
|
||||
"/",
|
||||
summary="获取前端常量字典",
|
||||
description="返回各模块状态/类型常量,便于前端一次性加载。",
|
||||
)
|
||||
async def get_constants():
|
||||
return {
|
||||
"task": {"status": task.TASK_STATUS, "priority": task.TASK_PRIORITY},
|
||||
"subject": {"status": subject.SUBJECT_STATUS, "visit_status": subject.VISIT_STATUS},
|
||||
"ae": {"seriousness": ae.AE_SERIOUSNESS, "severity": ae.AE_SEVERITY, "status": ae.AE_STATUS},
|
||||
"issue": {"category": issue.ISSUE_CATEGORY, "level": issue.ISSUE_LEVEL, "status": issue.ISSUE_STATUS},
|
||||
"finance": {"status": finance.FINANCE_STATUS, "category": finance.FINANCE_CATEGORY},
|
||||
"imp": {"tx_types": imp.IMP_TX_TYPES, "batch_status": imp.IMP_BATCH_STATUS},
|
||||
}
|
||||
Reference in New Issue
Block a user