from sqlalchemy.orm import Session from app.core.security import get_password_hash from app.models.user import User def init_db(db: Session) -> None: """ Initialize the database with a superuser if one doesn't exist. """ # Check if there are any users in the database user = db.query(User).first() if not user: # Create a superuser superuser = User( email="admin@example.com", hashed_password=get_password_hash("adminpassword"), full_name="Admin User", is_active=True, is_superuser=True, ) db.add(superuser) db.commit() db.refresh(superuser)