mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-07-26 16:41:51 +08:00
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user