/* ============================================================================= * M02_SO_Api.ts * 구조물 정의 서버 호출 — 서버 = `M02_SO_Router.py`(마스터 템플릿 `구조물정의.json` 한 벌 · PLAN 48) * ========================================================================== */ import { call } from "../M02_MasterTemplete_Api_Fetch"; import type { StructDef } from "./M02_SO_Def_Model"; /* --- 구조물 정의(PLAN 48 · 마스터 템플릿 `구조물정의.json` · 판 번호 · 이력) --- */ /** 지난 판 한 줄 */ export interface DefVersion { 판: number; 저장일: string; } /** 정의 한 벌 — 읽기 = 로그인 누구나 */ export const fetchStructureDef = (): Promise => call("/structure-definition"); /** 통째로 고쳐 씀(시스템 관리자만) — 읽어 간 판이 지금 판과 다르면 StaleError · 돌려받는 것 = 판 +1 정의 */ export const saveStructureDef = (판: number, 정의: StructDef): Promise => call("/structure-definition", { method: "PUT", body: JSON.stringify({ 판, 정의 }) }); /** 지난 판 목록(`구조물정의_이력/판_N.json`) */ export const fetchStructureDefHistory = (): Promise => call("/structure-definition/history"); export const fetchStructureDefAt = (판: number): Promise => call(`/structure-definition/history/${판}`);