Files
meeting-protocol-service/backend/app/main.py
T
2026-04-03 22:32:14 +05:00

45 lines
1.3 KiB
Python

from contextlib import asynccontextmanager
from fastapi import FastAPI
from sqlalchemy import select
from app.api.auth import router as auth_router
from app.api.exports import router as exports_router
from app.api.protocols import router as protocols_router
from app.api.recordings import router as recordings_router
from app.api.settings import router as settings_router
from app.api.templates import router as templates_router
from app.database import async_session
from app.models.prompt_template import PromptTemplate
from app.prompts.defaults import DEFAULT_TEMPLATES
async def seed_default_templates():
async with async_session() as db:
result = await db.execute(select(PromptTemplate))
if result.scalars().first() is not None:
return
for tpl in DEFAULT_TEMPLATES:
db.add(PromptTemplate(**tpl))
await db.commit()
@asynccontextmanager
async def lifespan(app: FastAPI):
await seed_default_templates()
yield
app = FastAPI(title="Meeting Protocol Service", lifespan=lifespan)
app.include_router(auth_router)
app.include_router(recordings_router)
app.include_router(protocols_router)
app.include_router(templates_router)
app.include_router(exports_router)
app.include_router(settings_router)
@app.get("/api/health")
async def health():
return {"status": "ok"}