async def get_sync_entity_dags(
    sync_id: UUID,
    db: AsyncSession = Depends(deps.get_db),
    current_user: User = Depends(deps.get_user),
):
    """Get list of DAGs, one for each entity."""
    dag_model = await sync_dag.get_by_sync_id(db, sync_id=sync_id, current_user=current_user)
    dag = schemas.SyncDag.from_orm(dag_model)

    source_node = dag.get_source_node()
    source_node_create = convert_to_node_create(source_node)

    destination_nodes = dag.get_destination_nodes()
    if not destination_nodes:
        raise HTTPException(status_code=400, detail="No destination nodes found in the DAG")
    else:
        destination_node = destination_nodes[0]
        destination_node_create = convert_to_node_create(destination_node)

    entity_dags = []
    edges_from_source = dag.get_edges_from_node(source_node.id)
    for edge_from_source in edges_from_source:
        edge_from_source_create = convert_to_edge_create(edge_from_source)

        entity_node = dag.get_node(edge_from_source.to_node_id)
        entity_node_create = convert_to_node_create(entity_node)

        entity_dag = schemas.SyncDagCreate(
            name=f"{entity_node.name} DAG",
            description=f"Disparate DAG for the entity {entity_node.name}.",
            sync_id=dag.sync_id,
            nodes=[source_node_create, entity_node_create, destination_node_create],
            edges=[edge_from_source_create],
        )

        _validate_entity_node_edges(dag, entity_node)
        _process_transformer_chain(dag, entity_dag, entity_node, destination_node_create)

        entity_dags.append(entity_dag)

    return entity_dags
Get list of DAGs, one for each entity.
backend/airweave/api/v1/endpoints/dag.py