feat(M02): 항목 하나 비우기 길 — 도면 · 일위대가 · 면적산출을 새 열과 같은 빈 문서로 (40-4)
- POST /api/m02/layers/{층}/{structures|labor|area}/{열}/clear(owner) · 번호 · 열 그대로 · 받는 층 쓰기 권한(_root)
- Store.clear · 면적을 비우면 그 열 일위대가 계산값 다시 · 장부 맞춤
- 화면 함수 Api_Fetch clearPart
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYJJRCfHfdCGNhmXTjQKV7
This commit is contained in:
@@ -226,6 +226,19 @@ export const copyPartFrom = async (
|
||||
});
|
||||
};
|
||||
|
||||
/** 항목 하나 비우기(40-4 · 카드 [삭제]) — 새 열과 같은 빈 문서 · 번호 · 열 그대로 · 지금 층 */
|
||||
export const clearPart = (
|
||||
kind: "structure" | "labor" | "area",
|
||||
column: string,
|
||||
): Promise<TemplateInfo> =>
|
||||
call(
|
||||
owned(
|
||||
activeLayer,
|
||||
`/layers/${activeLayer}/${kind === "structure" ? "structures" : kind}/${enc(column)}/clear`,
|
||||
),
|
||||
{ method: "POST" },
|
||||
);
|
||||
|
||||
/** 다른 열(`from`) 구조물 도면 내용을 받는 열(`column`)로 가져옴 — 도번 · 열은 받는 쪽 그대로 */
|
||||
export const copyStructure = async (column: string, from: string): Promise<void> => {
|
||||
await scoped(`/structures/${enc(column)}/copy?from=${enc(from)}`, { method: "POST" });
|
||||
|
||||
@@ -317,6 +317,20 @@ def _copy_practice(column: str, key: str) -> dict[str, Any]:
|
||||
return store.copy_from("labor", column, key, body=labor.from_combo(key))
|
||||
|
||||
|
||||
@router.post("/layers/{layer}/{kind}/{column}/clear")
|
||||
def post_clear(
|
||||
layer: Layer,
|
||||
kind: Literal["structures", "labor", "area"],
|
||||
column: str,
|
||||
owner: str | None = None,
|
||||
session: Session = Depends(verify_session),
|
||||
):
|
||||
"""항목 하나 비우기(40-4 · 카드 [삭제]) — 빈 문서 · 번호 · 열 그대로 · 받는 층 쓰기 권한."""
|
||||
folder = _root(session, layer, owner, write=True)
|
||||
part = "structure" if kind == "structures" else kind
|
||||
return _call(folder, store.clear, part, column)
|
||||
|
||||
|
||||
@router.post("/layers/{layer}/{kind}/{column}/copy")
|
||||
def post_copy(
|
||||
layer: Layer,
|
||||
|
||||
@@ -351,6 +351,21 @@ def create_structure(column: str) -> dict[str, Any]:
|
||||
return read("structure", column)
|
||||
|
||||
|
||||
def clear(kind: str, column: str) -> dict[str, Any]:
|
||||
"""항목 하나 비우기(40-4) — 새 열 만들 때와 같은 빈 문서로 다시 씀 · 번호 · 열 그대로 ·
|
||||
없는 파일은 404 · 면적산출을 비우면 그 열 일위대가 계산값도 다시 · 장부 맞춤."""
|
||||
if kind not in _KEY:
|
||||
raise StoreError(404, f"없는 종류 「{kind}」")
|
||||
number = read(kind, column)["문서"].get(_KEY[kind])
|
||||
with _LOCK:
|
||||
atomic_write_json(_path(kind, column), {**_blank(kind, column), _KEY[kind]: number})
|
||||
info = _info(kind, _path(kind, column))
|
||||
if kind == "area":
|
||||
_refresh_labor(column)
|
||||
sync_combos()
|
||||
return info
|
||||
|
||||
|
||||
def copy_from(
|
||||
kind: str,
|
||||
column: str,
|
||||
|
||||
Reference in New Issue
Block a user