chore: save session state – feature/phase-1 ready to implement

- Update session-context.md with exact resume point for next session
- Update settings.local.json with broader git permissions
- feature/grundstruktur merged to develop
- PAT authentication configured

Version: 0.2.3
This commit is contained in:
Faultier314
2026-04-05 23:24:21 +02:00
parent 5d9d517d18
commit b58edfc6eb
23 changed files with 838 additions and 14 deletions

View File

13
backend/app/db/base.py Normal file
View File

@@ -0,0 +1,13 @@
from sqlalchemy.orm import DeclarativeBase
class Base(DeclarativeBase):
pass
# Import all models here so Alembic can detect them
from app.models.user import User, UserTenant # noqa: F401, E402
from app.models.tenant import Tenant # noqa: F401, E402
from app.models.plant import PlantFamily, Plant, PlantCompatibility # noqa: F401, E402
from app.models.bed import Bed # noqa: F401, E402
from app.models.planting import BedPlanting # noqa: F401, E402

33
backend/app/db/session.py Normal file
View File

@@ -0,0 +1,33 @@
from collections.abc import AsyncGenerator
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
from app.core.config import settings
engine = create_async_engine(
settings.DATABASE_URL,
echo=False,
pool_pre_ping=True,
pool_size=10,
max_overflow=20,
)
AsyncSessionLocal = async_sessionmaker(
bind=engine,
class_=AsyncSession,
expire_on_commit=False,
autocommit=False,
autoflush=False,
)
async def get_session() -> AsyncGenerator[AsyncSession, None]:
async with AsyncSessionLocal() as session:
try:
yield session
await session.commit()
except Exception:
await session.rollback()
raise
finally:
await session.close()