260710_0
This commit is contained in:
@@ -10,20 +10,11 @@ from uuid import uuid4
|
||||
import aiomysql
|
||||
|
||||
from common_util.common_util_json import atomic_write_json
|
||||
from common_util.common_util_storage import PROJECT_STORAGE_LAYOUT_V2
|
||||
from common_util.common_util_workflow import load_project_workflow
|
||||
from config.config_db import get_db_pool
|
||||
from config.config_system import STORAGE_BASE_DIR
|
||||
|
||||
PROJECT_STAGE_SUBDIRS = (
|
||||
("B03_FileInput", "input"),
|
||||
("B04_wf1_Surface", "processed"),
|
||||
("B05_wf2_Route", "route"),
|
||||
("B06_wf3_ProfileCross", "profiles"),
|
||||
("B07_wf4_DesignDetail", "structures"),
|
||||
("B08_wf5_Quantity", "quantities"),
|
||||
("B09_wf6_Estimation", "v1"),
|
||||
)
|
||||
|
||||
|
||||
def _build_project_storage(company_id: int, user_id: int, project_id: str) -> tuple[str, Path]:
|
||||
relative_path = f"storage/{company_id}/{user_id}/{project_id}"
|
||||
@@ -35,16 +26,16 @@ def _build_project_storage(company_id: int, user_id: int, project_id: str) -> tu
|
||||
|
||||
|
||||
def _initialize_project_storage(project_root: Path, project_id: str) -> None:
|
||||
for stage, subdir in PROJECT_STAGE_SUBDIRS:
|
||||
for stage, subdir in PROJECT_STORAGE_LAYOUT_V2:
|
||||
(project_root / stage / subdir).mkdir(parents=True, exist_ok=True)
|
||||
atomic_write_json(project_root / "workflow.json", load_project_workflow(project_root))
|
||||
atomic_write_json(
|
||||
project_root / "project_manifest.json",
|
||||
{
|
||||
"project_id": project_id,
|
||||
"storage_version": 1,
|
||||
"storage_version": 2,
|
||||
"created_at": datetime.utcnow().isoformat(timespec="seconds"),
|
||||
"stages": [f"{stage}/{subdir}" for stage, subdir in PROJECT_STAGE_SUBDIRS],
|
||||
"stages": [f"{stage}/{subdir}" for stage, subdir in PROJECT_STORAGE_LAYOUT_V2],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user