- 구조물정의.json → resources/master_data/구조물정의/구조물정의.json(git mv · 내용 그대로) - 구조물정의_이력/판_1 ~ 22 → resources/master_data/구조물정의/이력/(git mv · 내용 그대로) - 읽는 자리 = B05 Structures_Schema DEFINITION_PATH · HISTORY_DIRNAME · M01_SO_Definition HISTORY - M01 요소 로더 · check_master 는 첫 층 *.json 만 읽음 — 새 폴더는 요소로 안 읽힘(수식문서/ 와 같은 대접) - 시험 · 도우미 · ui_checks 경로 글 고침(파일 이름 그대로) - resources/master_template 에 구조물 정의 자료 남지 않음 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
1.5 KiB
TypeScript
34 lines
1.5 KiB
TypeScript
/* =============================================================================
|
|
* M01_SO_Api.ts
|
|
* 구조물 정의 서버 호출 — 서버 = `M01_SO_Router.py`(마스터 템플릿 `구조물정의.json` 한 벌 · PLAN 48)
|
|
* ========================================================================== */
|
|
|
|
import { call as callApi } from "../../common_util/common_util_m02_call";
|
|
import type { StructDef } from "./M01_SO_Def_Model";
|
|
|
|
/** `/api/m01` 아래 길 부름 */
|
|
const call = <T>(path: string, init: RequestInit = {}): Promise<T> =>
|
|
callApi<T>(path, init, "/m01");
|
|
|
|
/* --- 구조물 정의(PLAN 48 · 마스터 템플릿 `구조물정의.json` · 판 번호 · 이력) --- */
|
|
|
|
/** 지난 판 한 줄 */
|
|
export interface DefVersion {
|
|
판: number;
|
|
저장일: string;
|
|
}
|
|
|
|
/** 정의 한 벌 — 읽기 = 로그인 누구나 */
|
|
export const fetchStructureDef = (): Promise<StructDef> => call("/structure-definition");
|
|
|
|
/** 통째로 고쳐 씀(시스템 관리자만) — 읽어 간 판이 지금 판과 다르면 StaleError · 돌려받는 것 = 판 +1 정의 */
|
|
export const saveStructureDef = (판: number, 정의: StructDef): Promise<StructDef> =>
|
|
call("/structure-definition", { method: "PUT", body: JSON.stringify({ 판, 정의 }) });
|
|
|
|
/** 지난 판 목록(`구조물정의/이력/판_N.json`) */
|
|
export const fetchStructureDefHistory = (): Promise<DefVersion[]> =>
|
|
call("/structure-definition/history");
|
|
|
|
export const fetchStructureDefAt = (판: number): Promise<StructDef> =>
|
|
call(`/structure-definition/history/${판}`);
|