Files
ctms/backend/app/api/v1/constants.py
T

23 lines
985 B
Python

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},
}