diff --git a/services/web/server/src/simcore_service_webserver/projects/_crud_api_create.py b/services/web/server/src/simcore_service_webserver/projects/_crud_api_create.py index 7ae8cb8654e3..04671fdd21b1 100644 --- a/services/web/server/src/simcore_service_webserver/projects/_crud_api_create.py +++ b/services/web/server/src/simcore_service_webserver/projects/_crud_api_create.py @@ -62,7 +62,7 @@ ] -log = logging.getLogger(__name__) +_logger = logging.getLogger(__name__) CopyFileCoro: TypeAlias = Coroutine[Any, Any, None] CopyProjectNodesCoro: TypeAlias = Coroutine[Any, Any, dict[NodeID, ProjectNodeCreate]] @@ -285,6 +285,13 @@ async def create_project( # pylint: disable=too-many-arguments,too-many-branche """ assert request.app # nosec + _logger.info( + "create_project for '%s' with %s %s %s", + f"{user_id=}", + f"{predefined_project=}", + f"{product_name=}", + f"{from_study=}", + ) _projects_repository = ProjectDBAPI.get_from_app_context(request.app) @@ -459,6 +466,17 @@ async def create_project( # pylint: disable=too-many-arguments,too-many-branche for gid, access in workspace.access_rights.items() } + _project_product_name = await _projects_repository.get_project_product( + project_uuid=new_project["uuid"] + ) + assert ( + _project_product_name == product_name # nosec + ), "Project product name mismatch" + if _project_product_name != product_name: + raise web.HTTPBadRequest( + text=f"Project product name mismatch {product_name=} {_project_product_name=}" + ) + data = ProjectGet.from_domain_model(new_project).model_dump( **RESPONSE_MODEL_POLICY ) @@ -488,7 +506,7 @@ async def create_project( # pylint: disable=too-many-arguments,too-many-branche raise web.HTTPNotFound(text=f"{exc}") from exc except asyncio.CancelledError: - log.warning( + _logger.warning( "cancelled create_project for '%s'. Cleaning up", f"{user_id=}", )