- Added TypeScript build info for frontend. - Created Vite configuration for React application. - Implemented pre-commit hook to run checks before commits. - Set up PostgreSQL Dockerfile with PostGIS support and initialization scripts. - Added database creation script for PostgreSQL with necessary extensions. - Established Python project configuration with dependencies and development tools. - Developed pre-commit script to enforce code quality checks for backend and frontend. - Created PowerShell script to set up Git hooks path.
25 lines
629 B
Python
25 lines
629 B
Python
from __future__ import annotations
|
|
|
|
from collections.abc import Generator
|
|
|
|
from sqlalchemy import create_engine
|
|
from sqlalchemy.orm import Session, sessionmaker
|
|
|
|
from backend.app.core.config import get_settings
|
|
|
|
settings = get_settings()
|
|
|
|
engine = create_engine(settings.sqlalchemy_database_url, echo=settings.database_echo, future=True)
|
|
SessionLocal = sessionmaker(bind=engine, autoflush=False, autocommit=False, expire_on_commit=False)
|
|
|
|
|
|
def get_db_session() -> Generator[Session, None, None]:
|
|
session = SessionLocal()
|
|
try:
|
|
yield session
|
|
finally:
|
|
session.close()
|
|
|
|
|
|
__all__ = ["engine", "SessionLocal", "get_db_session"]
|