- 옛 「옵션 보이기 · 그룹」 화면을 정의 편집 화면으로 넓힘(시스템 관리자 고쳐 씀 · 다른 역할 읽기만) - 자료 손질 = M02_SO_Def_Model.ts(정의 틀 48-1 꼴) · 시험 test_m02_so_def_model.py Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016PSXsvyDxjNmufteN5bqmt
30 lines
1.4 KiB
TypeScript
30 lines
1.4 KiB
TypeScript
/* =============================================================================
|
|
* 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<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/${판}`);
|