From 31c9fb6c611397fe8cafd458ee0b0e8ea047c33e Mon Sep 17 00:00:00 2001 From: umsangdon Date: Fri, 25 Sep 2026 10:02:43 +0900 Subject: [PATCH] =?UTF-8?q?fix(M02):=20=EC=B8=B5=20=EA=B8=B8=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EB=AA=A8=EC=96=91=20=C2=B7=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EC=A0=9D=ED=8A=B8=20=EC=B8=B5=20=ED=91=9C=EB=8A=94=20=EC=84=A4?= =?UTF-8?q?=EA=B3=84=EA=B0=92=20=EC=B1=84=EC=9A=B4=20=EB=AC=B8=EC=84=9C?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=B4=EC=9E=84=20(PLAN=2010-1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_0148XFUpPfpiuTjxF1EK9c95 --- .../M02_MasterTemplete_Api_Fetch.ts | 19 ++++++++++++++++--- .../M02_MasterTemplete_UI_Main.ts | 14 ++++++++++++-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/M02_MasterTemplete/M02_MasterTemplete_Api_Fetch.ts b/M02_MasterTemplete/M02_MasterTemplete_Api_Fetch.ts index 00c8cca4..9656e6b5 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Api_Fetch.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_Api_Fetch.ts @@ -20,7 +20,8 @@ export interface TemplateInfo { export interface TemplateDoc { 종류: Kind; 이름: string; - 판: string; + /** 프로젝트 층에서 작업본이 아직 없으면(옛 프로젝트) 시스템 양식이 와서 null */ + 판: string | null; 문서: unknown; } @@ -49,8 +50,16 @@ const head = (layer: Layer): string => const item = (layer: Layer, kind: Kind, name: string, projectId: string | null): string => `${head(layer)}/${kind}/${enc(name)}${layer === "system" ? "" : q(projectId)}`; -export const listTemplates = (layer: Layer, projectId: string | null): Promise => - call(layer === "system" ? head(layer) : `${head(layer)}${q(projectId)}`); +/** 시스템 길은 배열 · 층 길은 `{층, 양식: [...]}` — 둘 다 목록으로 */ +export const listTemplates = async ( + layer: Layer, + projectId: string | null, +): Promise => { + const got = await call( + layer === "system" ? head(layer) : `${head(layer)}${q(projectId)}`, + ); + return Array.isArray(got) ? got : got.양식; +}; export const readTemplate = ( layer: Layer, @@ -103,3 +112,7 @@ export interface SourceItem { } export const fetchSources = (id: string): Promise => call(`/projects/${enc(id)}/sources`); + +/** 설계값을 채운 표 문서 — 서버가 그때그때 채움 · 저장 안 함 */ +export const readFilled = (id: string, name: string): Promise => + call(`/projects/${enc(id)}/tables/${enc(name)}/filled`); diff --git a/M02_MasterTemplete/M02_MasterTemplete_UI_Main.ts b/M02_MasterTemplete/M02_MasterTemplete_UI_Main.ts index cda7a423..04f8ee4c 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_UI_Main.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_UI_Main.ts @@ -7,6 +7,7 @@ import { createButton, el, showToast } from "@ui/ui_template_elements"; import { t as L } from "@ui/ui_template_locale"; import { + readFilled, readTemplate, saveTemplate, StaleError, @@ -131,9 +132,18 @@ export function createMain(isAdmin: boolean): MainHandle { try { const got = await readTemplate(next.layer, next.kind, next.name, next.projectId); if (mine !== seq) return; - version = got.판; + version = got.판 ?? ""; loaded = got.문서; - await mount(got.문서, next); + // 프로젝트 층 표 — 작업본 판은 그대로 두고 보이는 문서만 설계값으로 채움(서버가 채움 · 저장 안 함) + const shown = + next.layer === "project" && next.kind === "table" && next.projectId + ? await readFilled(next.projectId, next.name).then( + (f) => f.문서, + () => got.문서, + ) + : got.문서; + if (mine !== seq) return; + await mount(shown, next); } catch (error) { if (mine !== seq) return; empty("");