from app.db.session import get_db
from app.db.crud import create_user, get_user_by_email
from app.db.schemas import UserCreate
from app.db.session import SessionLocal
def init() -> None:
db = SessionLocal()
user = get_user_by_email(db, email="{{cookiecutter.superuser_email}}")
if not user:
create_user(
db,
UserCreate(
email="{{cookiecutter.superuser_email}}",
password="{{cookiecutter.superuser_password}}",
is_active=True,
is_superuser=True,
),
)