23 lines
587 B
Python
23 lines
587 B
Python
from sqlalchemy.orm import Session
|
|
|
|
from app import crud, schemas
|
|
|
|
|
|
def init_db(db: Session) -> None:
|
|
"""
|
|
Initialize the database with default data.
|
|
"""
|
|
# Create default admin user if it doesn't exist
|
|
user = crud.user.get_by_email(db, email="admin@example.com")
|
|
if not user:
|
|
user_in = schemas.UserCreate(
|
|
email="admin@example.com",
|
|
password="admin",
|
|
full_name="Default Admin",
|
|
is_superuser=True,
|
|
)
|
|
user = crud.user.create(db, obj_in=user_in)
|
|
|
|
# Add other default data as needed
|
|
pass
|