File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
services/web/server/src/simcore_service_webserver/projects Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 55from models_library .projects import ProjectID
66from models_library .projects_nodes import Node , PartialNode
77from models_library .projects_nodes_io import NodeID
8+ from pydantic import TypeAdapter
89from simcore_postgres_database .utils_repos import transaction_context
910from simcore_postgres_database .webserver_models import projects_nodes
1011from sqlalchemy .ext .asyncio import AsyncConnection
@@ -60,6 +61,22 @@ async def get_node(
6061 return Node .model_validate (row , from_attributes = True )
6162
6263
64+ async def list_nodes (
65+ app : web .Application ,
66+ connection : AsyncConnection | None = None ,
67+ * ,
68+ project_id : ProjectID ,
69+ ) -> list [Node ]:
70+ async with transaction_context (get_asyncpg_engine (app ), connection ) as conn :
71+ result = await conn .stream (
72+ sa .select (* _SELECTION_PROJECTS_NODES_DB_ARGS ).where (
73+ projects_nodes .c .project_uuid == f"{ project_id } "
74+ )
75+ )
76+ rows = await result .all () or []
77+ return TypeAdapter (list [Node ]).validate_python (rows )
78+
79+
6380async def update_node (
6481 app : web .Application ,
6582 connection : AsyncConnection | None = None ,
You can’t perform that action at this time.
0 commit comments