Add events

This commit is contained in:
2025-12-15 03:22:29 +07:00
parent 1a882fb2e0
commit 4239ea8516
31 changed files with 7288 additions and 75 deletions

View File

@@ -6,8 +6,9 @@ from fastapi.staticfiles import StaticFiles
from pathlib import Path
from app.core.config import settings
from app.core.database import engine, Base
from app.core.database import engine, Base, async_session_maker
from app.api.v1 import router as api_router
from app.services.event_scheduler import event_scheduler
@asynccontextmanager
@@ -22,9 +23,13 @@ async def lifespan(app: FastAPI):
(upload_dir / "covers").mkdir(parents=True, exist_ok=True)
(upload_dir / "proofs").mkdir(parents=True, exist_ok=True)
# Start event scheduler
await event_scheduler.start(async_session_maker)
yield
# Shutdown
await event_scheduler.stop()
await engine.dispose()