未知(继上次中断)

This commit is contained in:
Cheng Zhou
2026-02-04 10:52:34 +08:00
parent 8e258d21a7
commit 737f84bf54
99 changed files with 5497 additions and 2143 deletions
+6
View File
@@ -1,3 +1,4 @@
import asyncio
from contextlib import asynccontextmanager
from fastapi import FastAPI
@@ -11,10 +12,13 @@ from app.crud.user import ensure_admin_exists
from app.db.base import Base
from app.db.session import SessionLocal, engine
from app.services.fee_seed import seed_demo_fees
from app.services.visit_scheduler import run_daily_lost_visit_job
@asynccontextmanager
async def lifespan(_: FastAPI):
stop_event = asyncio.Event()
scheduler_task = asyncio.create_task(run_daily_lost_visit_job(stop_event))
# Ensure models are imported so metadata is populated
from app.models import user as user_model # noqa: F401
@@ -26,6 +30,8 @@ async def lifespan(_: FastAPI):
await ensure_admin_exists(session)
await seed_demo_fees(session)
yield
stop_event.set()
await scheduler_task
async def _ensure_legacy_primary_keys(conn) -> None: