Files
Aislo/B05_Profile/B05_Profile_Api_Pipes_Draft.ts
T
eomsangdonandClaude Opus 5.5 4b6800e387 feat(472-6 6-B 노선 바뀐 [저장] 한 본문): 노선 저장 · 관 · 구조물 다시 얹기 · 횡단 고침 넘김을 서버 한 창구로 — 전부 아니면 없음
- POST /design/save 에 route(노선 초안) · carry(옛 노선 세션 칸) 칸 · 서버 = 노선 저장 → Node facility.rebase(rebasePipeDraft · rebaseStructureDraft) → 6-A 차례(새 노선) → Node stations.carry(routeCarryPatches) → 횡단 저장
- 되돌림 범위 = 노선 행 · 자식 표 · 단계 · 배수 폴더 · 노선 파일 · 지표면 확정(설계 지형 바꿈)
- 손 상단측은 안 넘김(요구 274) · 노선 바뀐 [확정] = [저장](새 노선 본 뒤 다시)
- 브라우저 = 노선 초안 + 사용자 칸만 한 본문 · 옛 차례 길(saveRouteDraft 뒤 flush · carryAfterRouteSave · keepDraftsOnNewRoute) · 부름 0 된 flush 창구 여섯 · saveCachedCrossPatches 걷음
- 등록부 R9 stations.carry · F10 facility.rebase · 옛 차례 단언 시험 한 본문 꼴로 · test_472_6_route_save(옛 길 = 새 길 · 실패 되돌림)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 12:07:12 +09:00

40 lines
2.0 KiB
TypeScript

/* =============================================================================
* B05_Profile_Api_Pipes_Draft.ts
* B05 배수유역도에서 고친 **관 목록 초안**(세션) — [저장]·[확정]에서만 정본으로 나간다.
*
* 왜 생겼나(2026-09-06 대응표 조사) — 관 추가·이동·삭제가 패널 메모리에만 있어, B06 으로
* 넘어가 [저장]하면 그 편집이 통째로 사라졌다(`savePipes()` 를 부르는 곳이 B05 [임시저장]
* 하나뿐이었다). 다른 조작값과 같은 규칙으로 세션에 쌓고 저장 앞단에서 함께 내보낸다.
*
* 자동저장은 하지 않는다(CLAUDE.md 5장).
*
* 관 목록의 주인은 설계 가게(`design_store` 의 `pipes`) 하나다(계획서 24-2a) — B05 배수유역도 ·
* B06 구조물 목록 모두 이 창구로 읽고 쓴다.
* ========================================================================== */
import { useDesignStore } from "../A00_Common/design/design_store";
import type { DetailPipeInput } from "../B04_PreProcess/B04_PreProcess_Api_Fetch";
import type { SavePart } from "../A00_Common/design/design_save_api";
/** 세션에 담는 관 한 벌 — 정본 PUT 이 그대로 받는 꼴이다. */
export type PendingPipes = DetailPipeInput[];
export function readPendingPipes(projectId: string): PendingPipes | null {
return useDesignStore(projectId, null).get("pipes");
}
export function writePendingPipes(projectId: string, next: PendingPipes | null): void {
useDesignStore(projectId, null).set("pipes", next);
}
/** 한 본문 [저장] 조각(472-6) — 초안 = `{points}` · 초안 없는 [확정] = 빈 본문(서버 저장분으로 다시 셈) ·
* 초안 없는 [저장] = null. 저장 뒤 초안 비움. */
export function pipesPart(projectId: string, confirm: boolean): SavePart | null {
const pending = readPendingPipes(projectId);
if (!pending && !confirm) return null;
return {
body: pending ? { points: pending } : {},
after: () => writePendingPipes(projectId, null),
};
}