Automated Action 43235eb604 Create TechDating API backend
- Setup project structure and basic FastAPI application
- Define database models for users, profiles, matches, and messages
- Set up database connection and create Alembic migrations
- Implement user authentication and registration endpoints
- Create API endpoints for profile management, matches, and messaging
- Add filtering and search functionality for tech profiles
- Setup environment variable configuration
- Create README with project information and setup instructions
2025-05-28 15:17:44 +00:00

28 lines
664 B
Python

from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from app.core.config import settings
# Ensure the database directory exists
settings.DB_DIR.mkdir(parents=True, exist_ok=True)
SQLALCHEMY_DATABASE_URL = f"sqlite:///{settings.DB_DIR}/db.sqlite"
engine = create_engine(
SQLALCHEMY_DATABASE_URL,
connect_args={"check_same_thread": False}
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base()
# Dependency to get DB session
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()