feat: add SQLite persistence models

This commit is contained in:
Bastian Wagner
2026-08-15 09:18:57 +02:00
parent 91728cba86
commit 318d7c8ddb
7 changed files with 269 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
from fastapi import FastAPI
from app.config import Settings, get_settings
from app.db.session import create_db_engine, create_session_factory, initialize_schema
def create_app(settings: Settings | None = None) -> FastAPI:
@@ -12,6 +13,11 @@ def create_app(settings: Settings | None = None) -> FastAPI:
app = FastAPI(title="MyWhoosh Garmin Sync")
app.state.settings = resolved
engine = create_db_engine(resolved.database_url)
initialize_schema(engine)
app.state.db_engine = engine
app.state.session_factory = create_session_factory(engine)
@app.get("/healthz")
def healthz() -> dict[str, str]:
return {"status": "ok"}