Files
gaokao-volunteer-system/admin/routes/meta.py
Hermes Agent 3f46811e49
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
release: cut v2.1
2026-06-13 14:49:58 +08:00

70 lines
1.3 KiB
Python

"""元数据路由 (T6.1).
提供客户端需要的固定枚举值,避免前端硬编码。
"""
from __future__ import annotations
from fastapi import APIRouter, Depends
from admin.auth import get_current_user
from admin.db import AdminUser
router = APIRouter(prefix="/api/meta", tags=["meta"])
# MVP 阶段仅返回 27 省中已实现规范检查器的省份
SUPPORTED_PROVINCES = [
"湖南",
"广东",
"湖北",
"安徽",
"江西",
"甘肃",
"黑龙江",
"江苏",
"福建",
"广西",
"北京",
"上海",
"天津",
"海南",
"浙江",
"山东",
"河北",
"重庆",
"辽宁",
"贵州",
"青海",
"吉林",
"河南",
"四川",
"新疆",
"云南",
"西藏",
]
ORDER_STATUSES = [
"pending",
"paid",
"serving",
"delivered",
"completed",
"refunded",
]
ORDER_SOURCES = ["xianyu", "wechat", "web", "school"]
SERVICE_VERSIONS = ["audit", "basic", "standard", "premium"]
@router.get("", summary="元数据枚举")
def meta(_: AdminUser = Depends(get_current_user)) -> dict:
return {
"supported_provinces": SUPPORTED_PROVINCES,
"order_statuses": ORDER_STATUSES,
"order_sources": ORDER_SOURCES,
"service_versions": SERVICE_VERSIONS,
}