feat: add SQLite persistence models
This commit is contained in:
@@ -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"}
|
||||
|
||||
Reference in New Issue
Block a user