smart-chatbot-api / app /utils /seeding.py
GitHub Actions
Deploy from GitHub Actions (2026-03-16 04:38 UTC)
4413b85
raw
history blame contribute delete
548 Bytes
import hashlib
from sqlalchemy import select
from sqlalchemy.orm import Session
from app.models.smart_models import Tenant
from app.utils.config import config_manager
config = config_manager.get_config()
def seed_demo_tenant(session: Session) -> None:
hashed_demo_api_key = hashlib.sha256(config.demo_api_key.encode()).hexdigest()
demo_tenant = session.scalars(select(Tenant).where(Tenant.name == "demo")).first()
if not demo_tenant:
session.add(Tenant(name="demo", api_key=hashed_demo_api_key))
session.commit()