File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
packages/models-library/src/models_library
services/storage/src/simcore_service_storage/modules/db Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -108,10 +108,20 @@ class BaseProjectModel(BaseModel):
108108
109109 # Pipeline of nodes (SEE projects_nodes.py)
110110 # FIXME: pedro checks this one
111- # NOTE: GCG: a validation failed (See: services/storage/src/simcore_service_storage/modules/db/projects.py)
112- workbench : Annotated [
113- NodesDict , Field (description = "Project's pipeline" , exclude = True )
114- ]
111+ # NOTE: GCR: a validation failed (See: services/storage/src/simcore_service_storage/modules/db/projects.py)
112+ workbench : Annotated [NodesDict , Field (description = "Project's pipeline" )]
113+
114+ @classmethod
115+ def model_validate_ignoring_workbench (cls , obj : Any ):
116+ if isinstance (obj , dict ):
117+ data = dict (obj )
118+ data .pop ("workbench" , None )
119+ else :
120+ data = obj
121+ model = cls .model_validate (data )
122+ if isinstance (obj , dict ) and "workbench" in obj :
123+ model .workbench = obj ["workbench" ]
124+ return model
115125
116126
117127class ProjectAtDB (BaseProjectModel ):
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ async def list_valid_projects_in(
3131 )
3232 ):
3333 with suppress (ValidationError ):
34- yield ProjectAtDB .model_validate (row )
34+ yield ProjectAtDB .model_validate_ignoring_workbench (row . _asdict () )
3535
3636 async def get_project_id_and_node_id_to_names_map (
3737 self ,
You can’t perform that action at this time.
0 commit comments