wip(M01): 자재 조합 M01 길 초안 — 합치기 전 임시(sub4 자재조합 표 위에 얹을 예정)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoyUwuTFiDJfvCfHpvKKzp
This commit is contained in:
@@ -15,6 +15,7 @@ from pydantic import BaseModel
|
||||
from M01_MasterData import M01_MasterData_Store as store
|
||||
from M01_MasterData import M01_MasterData_Store_Combo as combo_store
|
||||
from M01_MasterData import M01_MasterData_Store_Make as make
|
||||
from M01_MasterData import M01_MasterData_Store_Matset as matset_store
|
||||
|
||||
router = APIRouter(prefix="/api/m01", tags=["M01 MasterData"])
|
||||
|
||||
@@ -114,6 +115,20 @@ class PreviewCombo(BaseModel):
|
||||
inputs: dict[str, dict[str, Any]] = {}
|
||||
|
||||
|
||||
class NewMatset(BaseModel):
|
||||
"""자재 조합 — 담은 자재 목록만(코드 · 이름 · 규격 · 단위 · 수량 · 단가는 안 둠)."""
|
||||
|
||||
matset: dict[str, Any]
|
||||
owner: str = matset_store.OWNERS[0]
|
||||
|
||||
|
||||
class EditMatset(BaseModel):
|
||||
key: str
|
||||
version: str
|
||||
matset: dict[str, Any]
|
||||
owner: str = ""
|
||||
|
||||
|
||||
class DraftLogic(BaseModel):
|
||||
text: str # 줄로 적은 식 — 줄마다 「이름 = 식」
|
||||
decided: dict[str, Any] = {} # 변수마다 정한 것 {이름: {무엇, 단위, 비목, 요소·찾기·값}}
|
||||
@@ -349,3 +364,29 @@ def post_combo_delete(body: DeleteCombo) -> dict:
|
||||
def post_combo_preview(body: PreviewCombo) -> dict:
|
||||
"""담은 로직마다 값을 뽑아 비목별로 갈라 합계 — 저장하지 않음."""
|
||||
return _call(combo_store.combo_preview, body.combo, body.inputs)
|
||||
|
||||
|
||||
# ── 자재 조합(계약 9장 끝) ─────────────────────────────────────────────
|
||||
@router.get("/matsets")
|
||||
def get_matsets(q: str = "", owner: str = "") -> dict:
|
||||
return {"matsets": _call(matset_store.matsets, q, owner)}
|
||||
|
||||
|
||||
@router.get("/matset")
|
||||
def get_matset(key: str) -> dict:
|
||||
return _call(matset_store.matset, key)
|
||||
|
||||
|
||||
@router.post("/matset/new")
|
||||
def post_matset_new(body: NewMatset) -> dict:
|
||||
return _call(matset_store.matset_new, body.matset, body.owner)
|
||||
|
||||
|
||||
@router.post("/matset/edit")
|
||||
def post_matset_edit(body: EditMatset) -> dict:
|
||||
return _call(matset_store.matset_edit, body.key, body.version, body.matset, body.owner)
|
||||
|
||||
|
||||
@router.post("/matset/delete")
|
||||
def post_matset_delete(body: DeleteCombo) -> dict:
|
||||
return _call(matset_store.matset_delete, body.key, body.version)
|
||||
|
||||
Reference in New Issue
Block a user