async def enricher_for_all(
        self, db: AsyncSession, syncs: list[models.Sync]
    ) -> list[schemas.Sync]:
        """Efficiently enrich multiple syncs with their connections in a single query.

        This method retrieves all connections for all syncs in a single database query,
        making it much more efficient than processing each sync individually.

        Args:
            db (AsyncSession): The database session
            syncs (list[models.Sync]): The list of syncs to enrich

        Returns:
            list[schemas.Sync]: The list of enriched syncs
        """
        if not syncs:
            return []

        # Get all sync IDs
        sync_ids = [sync.id for sync in syncs]

        # Run a single query to get all connections for all syncs
        stmt = (
            select(Connection, SyncConnection)
            .join(SyncConnection, Connection.id == SyncConnection.connection_id)
            .where(SyncConnection.sync_id.in_(sync_ids))
        )
        result = await db.execute(stmt)
        all_connections = result.unique().all()

        # Create a mapping of sync_id to its connections
        sync_connections = {}
        for connection, sync_connection in all_connections:
            sync_id = sync_connection.sync_id
            if sync_id not in sync_connections:
                sync_connections[sync_id] = {
                    "source": None,
                    "destinations": [],
                    "embedding_model": None,
                }

            # Categorize the connection based on its type
            if connection.integration_type == IntegrationType.SOURCE:
                sync_connections[sync_id]["source"] = schemas.Connection.model_validate(connection)
            elif connection.integration_type == IntegrationType.DESTINATION:
                sync_connections[sync_id]["destinations"].append(
                    schemas.Connection.model_validate(connection)
                )
            elif connection.integration_type == IntegrationType.EMBEDDING_MODEL:
                sync_connections[sync_id]["embedding_model"] = schemas.Connection.model_validate(
                    connection
                )

        # Create enriched sync objects
        enriched_syncs = []
        for sync in syncs:
            # Prepare the data dictionary with all fields
            sync_dict = {**sync.__dict__}
            if "_sa_instance_state" in sync_dict:
                sync_dict.pop("_sa_instance_state")

            # Get connections for this sync
            connections = sync_connections.get(
                sync.id, {"source": None, "destinations": [], "embedding_model": None}
            )

            # Add connection IDs
            source = connections["source"]
            sync_dict["source_connection_id"] = source.id if source else None

            destinations = connections["destinations"]
            sync_dict["destination_connection_ids"] = [dest.id for dest in destinations]

            embedding_model = connections["embedding_model"]
            sync_dict["embedding_model_connection_id"] = (
                embedding_model.id if embedding_model else None
            )

            # Create the enriched sync
            enriched_syncs.append(schemas.Sync.model_validate(sync_dict))

        return enriched_syncs
Efficiently enrich multiple syncs with their connections in a single query.

        This method retrieves all connections for all syncs in a single database query,
        making it much more efficient than processing each sync individually.

        Args:
            db (AsyncSession): The database session
            syncs (list[models.Sync]): The list of syncs to enrich

        Returns:
            list[schemas.Sync]: The list of enriched syncs
        
backend/airweave/crud/crud_sync.py