feat(B02): 프로젝트 만들 때 시스템 양식 전부를 작업본 · _initial 로 복사 (PLAN 10-5)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015LuapLYqN1GGFD8Y1PStD5
This commit is contained in:
2026-09-25 09:46:57 +09:00
co-authored by Claude Opus 5.5
parent ab810c4a4a
commit a4e8e43e1a
2 changed files with 22 additions and 0 deletions
@@ -2,6 +2,7 @@
from __future__ import annotations
import logging
from datetime import datetime
from pathlib import Path
from typing import Any
@@ -16,6 +17,9 @@ from common_util.common_util_workflow import load_project_workflow
from common_util.common_util_workflow_state import initialize_project_stages
from config.config_db import get_db_pool
from config.config_system import STORAGE_BASE_DIR
from M02_MasterTemplete.M02_Template_Layers import seed_project
logger = logging.getLogger(__name__)
def _build_project_storage(company_id: int, user_id: int, project_id: str) -> tuple[str, Path]:
@@ -40,6 +44,12 @@ def _initialize_project_storage(project_root: Path, project_id: str) -> None:
"stages": [f"{stage}/{subdir}" for stage, subdir in PROJECT_STORAGE_LAYOUT_V2],
},
)
# 마스터 템플릿 — 시스템 양식 전부를 작업본 + `_initial/` 로(회사 공식이 있어도 시스템).
# 복사가 실패해도 프로젝트는 만듦 — 읽는 쪽이 시스템 양식으로 떨어짐.
try:
seed_project(project_root)
except OSError:
logger.exception("프로젝트 양식 복사 실패: project_id=%s", project_id)
async def create_project(
@@ -208,3 +208,15 @@ def test_채운_표는_작업본을_채워_돌려주고_저장_안_함(
assert row["값"]["sta"] == "NO.2" and row["값"]["pp_len|파형강관|1000"] == 12
assert got["결과"] == {"계산": {}} and got["판"] == before
assert layers.version_of(root / "templates/table/구조물집계표.json") == before
def test_프로젝트_만들기_자리에서_시스템_양식을_복사(world: dict[str, Any], tmp_path: Path) -> None:
from B02_ProjRegister.B02_ProjRegister_Repository import _initialize_project_storage
layers.write_template(layers.company_dir(7), "table", "구조물집계표", {"회사": 1})
root = tmp_path / "new_project"
_initialize_project_storage(root, "new")
got = layers.read_template(root / "templates", "table", "구조물집계표")
assert got["문서"] == {"판": 1, "열": []} # 회사 공식이 있어도 시스템
assert (root / "templates/_initial/drawing/A1_도각.json").is_file()
assert (root / "project_manifest.json").is_file()