@@ -1000,7 +1000,7 @@ async def is_project_hidden(app: web.Application, project_id: ProjectID) -> bool
10001000 return await db .is_hidden (project_id )
10011001
10021002
1003- async def update_project_node (
1003+ async def patch_project_node (
10041004 app : web .Application ,
10051005 * ,
10061006 product_name : ProductName ,
@@ -1009,10 +1009,9 @@ async def update_project_node(
10091009 node_id : NodeID ,
10101010 partial_node : PartialNode ,
10111011) -> None :
1012- _node_patch_exclude_unset : dict [str , Any ] = jsonable_encoder (
1013- partial_node , exclude_unset = True , by_alias = True
1014- )
1015- db : ProjectDBAPI = app [APP_PROJECT_DBAPI ]
1012+ _node_patch_exclude_unset : dict [str , Any ] = partial_node .model_dump (mode = 'json' , exclude_unset = True , by_alias = True )
1013+
1014+ _projects_repository = ProjectDBAPI .get_from_app_context (app )
10161015
10171016 # 1. Check user permissions
10181017 await check_user_project_permission (
@@ -1025,7 +1024,7 @@ async def update_project_node(
10251024
10261025 # 2. If patching service key or version make sure it's valid
10271026 if _node_patch_exclude_unset .get ("key" ) or _node_patch_exclude_unset .get ("version" ):
1028- _project , _ = await db .get_project (project_uuid = f"{ project_id } " )
1027+ _project , _ = await _projects_repository .get_project (project_uuid = f"{ project_id } " )
10291028 _project_node_data = _project ["workbench" ][f"{ node_id } " ]
10301029
10311030 _service_key = _node_patch_exclude_unset .get ("key" , _project_node_data ["key" ])
@@ -1042,7 +1041,7 @@ async def update_project_node(
10421041 )
10431042
10441043 # 3. Patch the project node
1045- updated_project , _ = await db .update_project_node_data (
1044+ updated_project , _ = await _projects_repository .update_project_node_data (
10461045 user_id = user_id ,
10471046 project_uuid = project_id ,
10481047 node_id = node_id ,
0 commit comments