fix: resolve all deprecation warnings

Pydantic V2:
- Replace @validator with @field_validator in models/config.py
- Replace .dict() with .model_dump() in Config, Settings, and BangumiDatabase
- Replace .parse_obj() with .model_validate() in Settings and tests
- Replace Field(example=) with Field(json_schema_extra=) in response models

Datetime:
- Replace datetime.utcnow() with datetime.now(timezone.utc) in jwt.py
- Update factories.py to use timezone-aware datetime

FastAPI:
- Migrate from deprecated @router.on_event() to lifespan context manager
- Move startup/shutdown handlers from program.py to main.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
EstrellaXD
2026-01-26 16:34:19 +01:00
parent 7b5c8d9ac5
commit 359b3e5253
9 changed files with 42 additions and 31 deletions

View File

@@ -1,4 +1,3 @@
import asyncio
import logging
import os
import signal
@@ -18,14 +17,7 @@ program = Program()
router = APIRouter(tags=["program"])
@router.on_event("startup")
async def startup():
asyncio.create_task(program.startup())
@router.on_event("shutdown")
async def shutdown():
await program.stop()
# Note: Lifespan events (startup/shutdown) are now handled in main.py via lifespan context manager
@router.get(