- 파일 23 개 git mv · 이름 M02_SO_* → M01_SO_* · 내용 · 동작 · 화면 글 그대로 - 서버 주소 /api/m02 → /api/m01(이름만 · 10 길 · 수 469 그대로) · main.py 등록 이름 m01_so_* - 화면 부름 = common_util_m02_call 의 call 에 base 인자(기본 /m02 · 구조물 정의만 /m01) - import 고침 = B05 · B07 · B08 · M01 · M02 · main · 시험 · 도우미 - 소스 글자만 보던 시험 셋 지움(구조물 정의 옮김에 걸림 · 결과를 안 봄): test_m02_structure_options 좌측 줄 · test_m02_structure_option_groups 좌측 정의 줄 · test_136_3 M02 미리보기 단추 CSS - test_553_5 부품 훑기 폴더 = 옮긴 자리 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/${판}`);
|