init commit. Skeleton prepared

This commit is contained in:
2025-08-08 19:48:03 +09:00
commit d58302c2c8
127 changed files with 1329 additions and 0 deletions

View File

View File

@@ -0,0 +1,26 @@
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, DeclarativeBase
from typing import Generator
DEFAULT_DB_URL = "postgresql+psycopg2://postgres:postgres@postgres:5432/auth_db"
class Base(DeclarativeBase):
pass
DATABASE_URL = os.getenv("DATABASE_URL", DEFAULT_DB_URL)
engine = create_engine(
DATABASE_URL,
pool_pre_ping=True,
future=True,
)
SessionLocal = sessionmaker(bind=engine, autoflush=False, autocommit=False)
def get_db() -> Generator:
db = SessionLocal()
try:
yield db
finally:
db.close()