from __future__ import annotations from sqlalchemy.ext.asyncio import AsyncSession from shared.events import register_handler from shared.models.domain_event import DomainEvent from glue.services.navigation import rebuild_navigation async def on_child_attached(event: DomainEvent, session: AsyncSession) -> None: await rebuild_navigation(session) async def on_child_detached(event: DomainEvent, session: AsyncSession) -> None: await rebuild_navigation(session) register_handler("container.child_attached", on_child_attached) register_handler("container.child_detached", on_child_detached)