From 5c8a4566bdfa01dafa9b31095b7bad65562e26c6 Mon Sep 17 00:00:00 2001 From: t0xa Date: Sun, 12 Oct 2025 16:27:47 +0300 Subject: [PATCH] Add sqlite + 0002 migration --- app/config.py | 2 ++ app/main.py | 7 ++++++- app/templates/base.html | 3 ++- migrations/runner.py | 24 +++++++++++++++--------- migrations/sql/0002_trainings.sql | 28 ++++++++++++++++++++++++++++ pyproject.toml | 5 +++++ run.py | 2 +- uv.lock | 16 +++++++++++++++- 8 files changed, 74 insertions(+), 13 deletions(-) create mode 100644 migrations/sql/0002_trainings.sql diff --git a/app/config.py b/app/config.py index f47ad35..6086eeb 100644 --- a/app/config.py +++ b/app/config.py @@ -9,6 +9,8 @@ class Settings(BaseSettings): version: str = "0.0.1" debug: bool = False + # TODO: Add sqlite 3 settings + # Postgres database settings POSTGRES_DATABASE_URL: Optional[str] = None POSTGRES_DATABASE_HOST: str = "localhost" diff --git a/app/main.py b/app/main.py index e3af335..d852401 100644 --- a/app/main.py +++ b/app/main.py @@ -10,6 +10,11 @@ from app.api.v1.web import web_router from app.config import settings from migrations.runner import MigrationRunner +# TODO: Replace level with settings value +logging.basicConfig( + level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s" +) + @asynccontextmanager async def lifespan(app: FastAPI): @@ -24,7 +29,7 @@ app = FastAPI( title="Fitness Parser API", description="API for parsing fitness training data from various sources", version="0.1.0", - lifespan=lifespan + lifespan=lifespan, ) app.mount("/static", StaticFiles(directory="app/static"), name="static") diff --git a/app/templates/base.html b/app/templates/base.html index 503835c..ab1b48e 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -13,7 +13,8 @@