refactor(859-5 ②): 구조물 정의 코드 M02 StructOptions → M01_MasterData/StructOptions

- 파일 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>
This commit is contained in:
2026-11-18 21:42:33 +09:00
co-authored by Claude Opus 5.5
parent 47d2fe7192
commit e4b9b3e5a3
77 changed files with 207 additions and 234 deletions
@@ -47,7 +47,7 @@ def plan_structure(item: Any) -> dict[str, Any]:
def structure_table() -> tuple[list[dict[str, Any]], dict[str, Any]]:
"""구조물 종류(`/projects/structure-types` 꼴) · 정의(화면 `useCatalogDefinition` 꼴)."""
from B05_Profile.B05_Profile_Structures_Schema import _read_definition, _stamp
from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible
from M01_MasterData.StructOptions.M01_SO_Options import with_visible
types = [item.model_dump(mode="json") for item in with_visible().types]
return types, {"types": types, **_read_definition(*_stamp())}
@@ -18,7 +18,7 @@ from B05_Profile.B05_Profile_Structures_Schema import (
structure_type_map,
)
from common_util.common_util_json import atomic_write_json
from M02_MasterTemplete.StructOptions.M02_SO_Options import hidden_keys
from M01_MasterData.StructOptions.M01_SO_Options import hidden_keys
STRUCTURES_FILE_NAME = "structures.json"
_STAGE_DIR = os.path.join("B05_Profile", "route")
+1 -1
View File
@@ -51,7 +51,7 @@ from common_util.common_util_route_follow import (
from common_util.common_util_storage import resolve_stored_project_path
from common_util.common_util_structure_station import SAME_STATION_M, plan_stations
from config.config_db import get_db_pool
from M02_MasterTemplete.StructOptions.M02_SO_Options import TypesWithVisible, with_visible
from M01_MasterData.StructOptions.M01_SO_Options import TypesWithVisible, with_visible
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -159,7 +159,7 @@ def is_station_planting_type(item: StructureType) -> bool:
return row is not None and row["station"] != "none"
#: 지난 판 정의(`판_N.json`) 폴더 — 정본 옆(M02 `M02_SO_Definition.HISTORY` 와 같은 이름)
#: 지난 판 정의(`판_N.json`) 폴더 — 정본 옆(M02 `M01_SO_Definition.HISTORY` 와 같은 이름)
HISTORY_DIRNAME = "구조물정의_이력"
@@ -243,7 +243,7 @@ def with_option_lines(things: list[Thing]) -> list[Thing]:
return things
try:
# 지연 import — M02 정의 저장소가 B07 엔진 import 차례에 끼지 않게
from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible
from M01_MasterData.StructOptions.M01_SO_Options import with_visible
payload = {
"things": [
+2 -2
View File
@@ -52,15 +52,15 @@ from B06_Section.B06_Section_Repository import (
)
from B08_Quantity.B08_Quantity_Router_Hydro import _project_root
from B08_Quantity.B08_Quantity_Summary_Sheet import _linked, _Sheet, unlinked_facilities
from common_util.common_util_structure_catalog import type_ids_with
from common_util.common_util_drainage_pipes import pipe_points_path_in, read_pipe_points_file
from common_util.common_util_structure_catalog import type_ids_with
from common_util.common_util_summary_item import GROUP_JOIN
from config.config_db import get_db_pool
from M01_MasterData.StructOptions import M01_SO_Definition as definition
from M02_MasterTemplete import M02_Item_Snapshot as snapshots
from M02_MasterTemplete import M02_Table_Fill as fill
from M02_MasterTemplete import M02_Template_Layers as layers
from M02_MasterTemplete.M02_Table_Fill_Spec import soil_tiers_from_designs
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
router = APIRouter(prefix="/api/projects", tags=["B08 Summary"])
+1 -1
View File
@@ -1,7 +1,7 @@
/* =============================================================================
* M01_MasterData_UI_Page.ts
* 마스터 요소 화면 — 좌측 도킹 패널(컨테이너: 인력·재료·기계·소요량·계수·환율·요율·단가산출 로직)
* · 일위대가 조합은 M02 마스터 템플릿(PLAN 27-2b) · 구조물 옵션 정의(716-1 · 화면은 M02 `StructOptions/`)
* · 일위대가 조합은 M02 마스터 템플릿(PLAN 27-2b) · 구조물 옵션 정의(716-1 · 859-5 화면 · 서버 = `StructOptions/`)
* / 우측 요소 표 · 표 목록 · 로직 편집 · 옵션 정의 · 별칭 모아 보기(815-2) ·
* 주소 `?open=로직|옵션|별칭` = 그 칸을 고른 채 열림(716-2)
*
+2 -5
View File
@@ -2,7 +2,7 @@
* M01_MasterData_UI_Side.ts
* 왼쪽 패널 — 공용 접기 컨테이너(`ui-collapsible ui-sidebar-section`)
* 인력 · 재료 · 기계 · 소요량 · 계수 · 환율 · 요율 · 단가산출 로직(일위대가 조합은 M02 · PLAN 27-2b)
* ─ 구분선 ─ 구조물 옵션 정의(716-1 · 화면 코드는 M02 `StructOptions/` 그대로 · 입구만 여기)
* ─ 구분선 ─ 구조물 옵션 정의(716-1 · 화면 코드 = `StructOptions/`(859-5) · 입구만 여기)
* · 별칭 모아 보기(815-2 · 누르면 본 칸에 별칭이 적힌 줄 · 승인 대기 · `M01_MasterData_UI_Alias`)
* 펼치면 하위 목록(거름 · 파일) · 환율/요율은 누르면 바로 표 · 로직은 안에 로직 목록
* ========================================================================== */
@@ -11,10 +11,7 @@ import { createSelectField, el, showToast } from "@ui/ui_template_elements";
import { attachCollapsible } from "@ui/ui_template_collapsible";
import { createDivider } from "@ui/ui_template_divider";
import { currentLanguageIndex, t as L } from "@ui/ui_template_locale";
import {
buildOptionsSection,
type OptionsSectionOptions,
} from "../M02_MasterTemplete/StructOptions/M02_SO_Options";
import { buildOptionsSection, type OptionsSectionOptions } from "./StructOptions/M01_SO_Options";
import { ALIAS_TITLE, buildAliasBoard, type AliasRow } from "./M01_MasterData_UI_Alias";
import { fetchFiles, fetchSubsAll, type FileInfo, type SubInfo } from "./M01_MasterData_Api_Fetch";
import { tx } from "./M01_MasterData_UI_Logic_Text";
@@ -1,10 +1,14 @@
/* =============================================================================
* M02_SO_Api.ts
* 구조물 정의 서버 호출 — 서버 = `M02_SO_Router.py`(마스터 템플릿 `구조물정의.json` 한 벌 · PLAN 48)
* M01_SO_Api.ts
* 구조물 정의 서버 호출 — 서버 = `M01_SO_Router.py`(마스터 템플릿 `구조물정의.json` 한 벌 · PLAN 48)
* ========================================================================== */
import { call } from "../M02_MasterTemplete_Api_Fetch";
import type { StructDef } from "./M02_SO_Def_Model";
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` · 판 번호 · 이력) --- */
@@ -7,7 +7,7 @@
그림이 늘 기본값을 씀 · 앞 판에서 이미 숨긴 칸은 그대로 둠)
- 앞 판이 없으면(옛 판 읽기) 꼴만 검사
- 앞 판과 비교 — 종류 지우기 없음 · 자리꼴 · 정본 · 군 글자 고정 · 선택지 값 고정(이름은 이름 표로)
화면 짝 = `M02_SO_Def_Check.ts`(같은 글)
화면 짝 = `M01_SO_Def_Check.ts`(같은 글)
거울 시험 = `resources/tester/test_322_2_check_mirror.py`.
"""
@@ -19,7 +19,7 @@ from typing import Any
from common_util.common_util_structure_catalog import load_parts, resolve_catalog
BRANCHES = ("횡단도", "카드이름", "형상", "3D")
# 화면 글(322-2 다듬기 · TS `M02_SO_Def_Reflect` 짝) — 자리꼴 · 정본 한국어 · 부품 짧은 이름
# 화면 글(322-2 다듬기 · TS `M01_SO_Def_Reflect` 짝) — 자리꼴 · 정본 한국어 · 부품 짧은 이름
PLACE_KO = {"point": "점", "interval": "구간", "site": "터"}
OWNER_KO = {"pipe_points": "관 지점", "structures": "구조물"}
@@ -1,23 +1,23 @@
/* =============================================================================
* M02_SO_Def.ts
* M01_SO_Def.ts
* 구조물 정의 편집 화면(PLAN 48-2 · 메인 칸) — 탭 셋(322-2): 「한눈 표」(종류마다 반영 한 줄 ·
* `M02_SO_Def_Table`) · 「종류별」(왼쪽 구조물군 · 종류 목록 · 오른쪽 고른 종류 이름 · 반영 · 명세 이름 나무 ·
* 줄마다 보임 · 미리보기) · 「부품」(`M02_SO_Def_Parts`) ·
* 아래 검사(화면 = 서버 짝 `M02_SO_Def_Check`) · [저장](판 +1 · 목록 + enabled 함께 · 시스템 관리자만) ·
* `M01_SO_Def_Table`) · 「종류별」(왼쪽 구조물군 · 종류 목록 · 오른쪽 고른 종류 이름 · 반영 · 명세 이름 나무 ·
* 줄마다 보임 · 미리보기) · 「부품」(`M01_SO_Def_Parts`) ·
* 아래 검사(화면 = 서버 짝 `M01_SO_Def_Check`) · [저장](판 +1 · 목록 + enabled 함께 · 시스템 관리자만) ·
* 지난 판 목록(누르면 그 판을 읽기만으로 봄).
* 다른 역할은 읽기만. 고칠 사본은 저장 전까지 서버에 안 감 · 정본 = `구조물정의.json`(48-1).
* ========================================================================== */
import { createButton, createTag, el, showToast } from "@ui/ui_template_elements";
import { StaleError } from "../M02_MasterTemplete_Api_Fetch";
import { StaleError } from "../../common_util/common_util_m02_call";
import {
fetchStructureDef,
fetchStructureDefAt,
fetchStructureDefHistory,
saveStructureDef,
type DefVersion,
} from "./M02_SO_Api";
import { buildLayoutBlock } from "./M02_SO_Def_Layout";
} from "./M01_SO_Api";
import { buildLayoutBlock } from "./M01_SO_Def_Layout";
import {
baseShown,
clone,
@@ -25,19 +25,19 @@ import {
stepFamily,
stepType,
type StructDef,
} from "./M02_SO_Def_Model";
import { buildOptionsBlock } from "./M02_SO_Def_Options";
import { buildRulesBlock } from "./M02_SO_Def_Rules";
import { buildSpecBlock } from "./M02_SO_Def_Spec";
} from "./M01_SO_Def_Model";
import { buildOptionsBlock } from "./M01_SO_Def_Options";
import { buildRulesBlock } from "./M01_SO_Def_Rules";
import { buildSpecBlock } from "./M01_SO_Def_Spec";
import { specFor } from "../../A00_Common/design/logic/design_structure_pipe";
import { catalogProblems, type CheckDef } from "./M02_SO_Def_Check";
import { buildParts } from "./M02_SO_Def_Parts";
import { differs, setReflect, tidy } from "./M02_SO_Def_Reflect";
import { buildReflectBlock, buildTable } from "./M02_SO_Def_Table";
import { checkBox, pickBox, textBox } from "./M02_SO_Def_Ui";
import { addFromTemplate, templates } from "./M02_SO_Def_Add";
import { buildGroupBlock } from "./M02_SO_Groups";
import { to } from "./M02_SO_Text";
import { catalogProblems, type CheckDef } from "./M01_SO_Def_Check";
import { buildParts } from "./M01_SO_Def_Parts";
import { differs, setReflect, tidy } from "./M01_SO_Def_Reflect";
import { buildReflectBlock, buildTable } from "./M01_SO_Def_Table";
import { checkBox, pickBox, textBox } from "./M01_SO_Def_Ui";
import { addFromTemplate, templates } from "./M01_SO_Def_Add";
import { buildGroupBlock } from "./M01_SO_Groups";
import { to } from "./M01_SO_Text";
import { createText } from "@ui/ui_template_text";
import { createEmpty } from "@ui/ui_template_empty";
import { createTabs } from "@ui/ui_template_tabs";
@@ -1,5 +1,5 @@
/* =============================================================================
* M02_SO_Def_Add.ts
* M01_SO_Def_Add.ts
* 종류 더하기(PLAN 323-7) — 본보기(구조물 정본 원본 종류)를 그대로 복사한 새 종류.
*
* 키 자동(`{본보기}_xxxxxx` · 만든 뒤 안 바뀜) · 이름 「{본보기} 2」(겹치면 3 …) · 군 · 자리꼴 · 옵션 · 표시 · 그룹 ·
@@ -8,7 +8,7 @@
* 명세도 본보기 키로 고름(`baseType`). 관 지점 정본 종류는 본보기에서 뺌(관 시설 폼 · 정본 목록이 따로).
* ========================================================================== */
import { clone, newKey, type StructDef } from "./M02_SO_Def_Model";
import { clone, newKey, type StructDef } from "./M01_SO_Def_Model";
/** 본보기로 고를 수 있는 종류 — 구조물 정본 · 원본(본보기 아님) · [키, 이름] (정의 차례). */
export const templates = (def: StructDef): Array<[string, string]> =>
@@ -1,5 +1,5 @@
/* =============================================================================
* M02_SO_Def_Check.ts
* M01_SO_Def_Check.ts
* 구조물 표 검사(PLAN 322-2 · 1-3 규칙) — 정의 `반영` · `부품` 꼴 · 표 줄과 부품이 맞음 · 만든 뒤 고정.
*
* · 반영 = `{종류: {목록 · 횡단도 · 카드이름 · 형상 · 형상칸 · 3D}}` · 값 = 부품 상자에 있는 것
@@ -9,7 +9,7 @@
* 그림이 늘 기본값을 씀 · 앞 판에서 이미 숨긴 칸은 그대로 둠)
* · 앞 판이 없으면(옛 판 읽기) 꼴만 검사
* · 앞 판과 비교 — 종류 지우기 없음 · 자리꼴 · 정본 · 군 글자 고정 · 선택지 값 고정(이름은 이름 표로)
* 서버 짝 = `M02_SO_Check.py`(같은 글) · 거울 시험 = `resources/tester/test_322_2_check_mirror.py`.
* 서버 짝 = `M01_SO_Check.py`(같은 글) · 거울 시험 = `resources/tester/test_322_2_check_mirror.py`.
* ========================================================================== */
import PARTS from "../../common_util/common_util_structure_parts.json" with { type: "json" };
@@ -17,7 +17,7 @@ import {
resolveCatalog,
type CatalogDefinition,
} from "../../common_util/common_util_structure_catalog";
import { OWNER_KO, PLACE_KO, shortName } from "./M02_SO_Def_Reflect";
import { OWNER_KO, PLACE_KO, shortName } from "./M01_SO_Def_Reflect";
type Branch = "횡단도" | "카드이름" | "형상" | "3D";
interface Part {
@@ -1,5 +1,5 @@
/* =============================================================================
* M02_SO_Def_Layout.ts
* M01_SO_Def_Layout.ts
* 구조물 정의 편집 화면(PLAN 48-2) — 고른 종류의 **배치 격자**(B05 · B06 좌측 구조물 칸 = 두 칸)
* 옵션마다 줄 · 칸 · 너비 + 미리보기(기준 측점은 맨 위 한 줄 · 겹치면 빨강).
* 자리를 안 정한 옵션은 차례대로 빈 칸을 채움 · 숫자를 고치면 그 옵션 자리만 정의 `배치` 에 남음.
@@ -15,9 +15,9 @@ import {
type Spot,
type StructDef,
type TypeDef,
} from "./M02_SO_Def_Model";
import { head, numberBox } from "./M02_SO_Def_Ui";
import { to } from "./M02_SO_Text";
} from "./M01_SO_Def_Model";
import { head, numberBox } from "./M01_SO_Def_Ui";
import { to } from "./M01_SO_Text";
export interface LayoutBlockOptions {
def: StructDef;
@@ -1,5 +1,5 @@
/* =============================================================================
* M02_SO_Def_Model.ts
* M01_SO_Def_Model.ts
* 구조물 정의 편집 화면(PLAN 48-2)의 자료 꼴 · 순수 손질 함수 — 화면 그리기 없음.
* 정본 = 마스터 템플릿 `구조물정의.json`(48-1 · 틀 `docs/raw/M02_구조물옵션정의/정의_틀.md`).
* 키는 만들 때 자동 · 안 바뀜 · 이름 자유 · 지움 = 「안 씀」(`enabled: false`).
@@ -226,7 +226,7 @@ export function overlaps(cells: Map<string, Spot>): string[] {
return [...bad];
}
/** 규칙 한 줄이 틀렸나 — 서버 검사(`M02_SO_Definition._rule_errors`)와 같은 뜻 */
/** 규칙 한 줄이 틀렸나 — 서버 검사(`M01_SO_Definition._rule_errors`)와 같은 뜻 */
export function ruleBad(def: StructDef, r: RuleDef): boolean {
const t = def.types.find((x) => x.type_id === r.종류);
const src = t?.options.find((o) => o.key === r.만약.옵션);
@@ -1,10 +1,10 @@
/* =============================================================================
* M02_SO_Def_Options.ts
* M01_SO_Def_Options.ts
* 구조물 정의 편집 화면(PLAN 48-2) — 고른 종류의 **옵션 목록**
* (이름 · 꼴 · 단위 · 기본값 · 보이기 · 들어갈 자리 · 안 씀 · 순서 · [옵션 더함]) +
* 고르기 꼴의 **선택지 목록**(이름 바꿈 · 빼기 · 순서 · [선택지 더함]).
* 옵션 키는 더할 때 자동 · 안 바뀜 · 선택지는 글이 곧 값(이름 바꿈 = 기본값 · 규칙도 같이) ·
* 저장은 화면 [저장](`M02_SO_Def.ts`).
* 저장은 화면 [저장](`M01_SO_Def.ts`).
* ========================================================================== */
import { createButton, createTag, el, showConfirmDialog } from "@ui/ui_template_elements";
@@ -16,10 +16,10 @@ import {
type OptionForm,
type StructDef,
type TypeDef,
} from "./M02_SO_Def_Model";
import { checkBox, head, moveButtons, pickBox, textBox } from "./M02_SO_Def_Ui";
import { buildPlaceSelect } from "./M02_SO_Groups";
import { to } from "./M02_SO_Text";
} from "./M01_SO_Def_Model";
import { checkBox, head, moveButtons, pickBox, textBox } from "./M01_SO_Def_Ui";
import { buildPlaceSelect } from "./M01_SO_Groups";
import { to } from "./M01_SO_Text";
import { createText } from "@ui/ui_template_text";
import { createEmpty } from "@ui/ui_template_empty";
@@ -1,12 +1,12 @@
/* =============================================================================
* M02_SO_Def_Parts.ts
* M01_SO_Def_Parts.ts
* 구조물 정의 「부품」 탭(PLAN 322-2) — 코드가 그리는 방법(부품 상자 `common_util_structure_parts.json`).
* 갈래마다 부품 · 이름 · 읽는 칸 · 맞는 자리꼴 · 정본 · 쓰는 종류 · 켬/끔(정의 `부품` = 끈 것만).
* 끈 부품을 쓰는 종류는 그 갈래가 없음(카드 이름은 종류 이름)으로 — 표 줄(`resolveCatalog`)이 따름.
* ========================================================================== */
import { el } from "@ui/ui_template_elements";
import type { StructDef } from "./M02_SO_Def_Model";
import type { StructDef } from "./M01_SO_Def_Model";
import {
OWNER_KO,
PART_BOX,
@@ -15,9 +15,9 @@ import {
setPartOn,
shortName,
usersOf,
} from "./M02_SO_Def_Reflect";
import { checkBox, head } from "./M02_SO_Def_Ui";
import { to } from "./M02_SO_Text";
} from "./M01_SO_Def_Reflect";
import { checkBox, head } from "./M01_SO_Def_Ui";
import { to } from "./M01_SO_Text";
import { createText } from "@ui/ui_template_text";
type Branch = keyof typeof PART_BOX;
@@ -1,5 +1,5 @@
/* =============================================================================
* M02_SO_Def_Reflect.ts
* M01_SO_Def_Reflect.ts
* 구조물 표 편집(PLAN 322-2)의 순수 손질 — 정의 사본의 `반영` · `부품` · 목록 + enabled · 형상칸.
*
* · 지금 값 = 구조물 표 한 줄(`resolveCatalog` · 정의 반영 ⊕ 처음값 ⊕ 부품 끔)
@@ -14,7 +14,7 @@ import {
type CatalogDefinition,
type CatalogRow,
} from "../../common_util/common_util_structure_catalog";
import { clone, type StructDef } from "./M02_SO_Def_Model";
import { clone, type StructDef } from "./M01_SO_Def_Model";
export type ReflectField = "목록" | "횡단도" | "카드이름" | "형상" | "3D";
type Reflect = Partial<Record<ReflectField, string>> & { 형상칸?: Record<string, unknown> };
@@ -126,7 +126,7 @@ export function setPartOn(def: StructDef, key: string, on: boolean): void {
}
/** 못 숨김 칸 — 종류가 지금 쓰는 부품들이 읽는 칸 중 기본값도 비워 두는 뜻도 없는 옵션
* (숨기면 그림이 받을 값이 없음 · 검사 짝 `M02_SO_Def_Check`). */
* (숨기면 그림이 받을 값이 없음 · 검사 짝 `M01_SO_Def_Check`). */
export function readKeys(def: StructDef, typeId: string): Set<string> {
const row = rowsOf(def).get(typeId);
if (!row) return new Set();
@@ -1,5 +1,5 @@
/* =============================================================================
* M02_SO_Def_Rules.ts
* M01_SO_Def_Rules.ts
* 구조물 정의 편집 화면(PLAN 48-2) — 고른 종류의 **규칙 표**(정의 `규칙` 중 그 종류 것만)
* 「만약 상위 옵션 = 값들 중 하나 → 하위 옵션의 선택지 · 보이기 · 기본값」 한 줄씩 · [규칙 더함] · 지우기.
* 「그대로」 칸은 정의에 안 남김 · 셋 다 그대로면 틀린 줄(빨강) · 적용은 B05 · B06(48-4).
@@ -13,9 +13,9 @@ import {
type RuleDef,
type StructDef,
type TypeDef,
} from "./M02_SO_Def_Model";
import { head, pickBox } from "./M02_SO_Def_Ui";
import { to } from "./M02_SO_Text";
} from "./M01_SO_Def_Model";
import { head, pickBox } from "./M01_SO_Def_Ui";
import { to } from "./M01_SO_Text";
import { createEmpty } from "@ui/ui_template_empty";
import { createCheckbox } from "@ui/ui_template_checkbox";
@@ -1,5 +1,5 @@
/* =============================================================================
* M02_SO_Def_Spec.ts
* M01_SO_Def_Spec.ts
* 구조물 명세가 있는 종류(PLAN 52 · `STRUCTURE_SPECS`)의 이름 고치기 칸(52-11) — 나무 꼴
* 컨테이너 제목 › 항목 이름 › 값 이름 · 이름만 고침 · 키 · 필수/선택 · 꼴은 읽기만 ·
* 아래 미리보기 = B05 · B06 이 그리는 같은 명세 폼(`createSpecForm`)에 고친 이름을 얹음.
@@ -18,16 +18,16 @@ import {
} from "../../A00_Common/design/logic/design_structure_spec";
import { group } from "../../B05_Profile/B05_Profile_UI_Drainage_Facility_Fields";
import { field, optionControl } from "../../B05_Profile/B05_Profile_UI_Structures_Fields";
import type { StructDef, TypeDef } from "./M02_SO_Def_Model";
import type { StructDef, TypeDef } from "./M01_SO_Def_Model";
import {
groupNameRows,
setSpecName,
specNameRows,
type SpecNameRow,
} from "./M02_SO_Def_Spec_Model";
import { hiddenKeys, readKeys, setShown } from "./M02_SO_Def_Reflect";
import { checkBox, head, textBox } from "./M02_SO_Def_Ui";
import { to, type OptionsTextKey } from "./M02_SO_Text";
} from "./M01_SO_Def_Spec_Model";
import { hiddenKeys, readKeys, setShown } from "./M01_SO_Def_Reflect";
import { checkBox, head, textBox } from "./M01_SO_Def_Ui";
import { to, type OptionsTextKey } from "./M01_SO_Text";
import { createEmpty } from "@ui/ui_template_empty";
const TAG: Record<NonNullable<SpecNameRow["tag"]>, OptionsTextKey> = {
@@ -1,5 +1,5 @@
/* =============================================================================
* M02_SO_Def_Spec_Model.ts
* M01_SO_Def_Spec_Model.ts
* 구조물 명세(PLAN 52 · `design_structure_spec`) 이름 고치기(52-11)의 자료 손질 — 화면 그리기 없음.
*
* · 명세 = 구조 정본(키 · 컨테이너 · 필수/선택 · 꼴) — 여기서는 **이름만** 고침
@@ -12,7 +12,7 @@
* ========================================================================== */
import type { StructureSpec } from "../../A00_Common/design/logic/design_structure_spec";
import type { StructDef, TypeDef } from "./M02_SO_Def_Model";
import type { StructDef, TypeDef } from "./M01_SO_Def_Model";
export interface SpecNameRow {
/** 0 = 컨테이너 · 1 = 항목 · 2 = 값 */
@@ -1,14 +1,14 @@
/* =============================================================================
* M02_SO_Def_Table.ts
* M01_SO_Def_Table.ts
* 구조물 정의 「한눈 표」 탭(PLAN 322-2) — 종류마다 B05 · B06 반영 한 줄.
* 군 · 종류(▲▼) · 이름 · 목록 · 자리꼴 · 정본(읽기만 「고정」) · 횡단도 · 카드 이름 · 형상(+ 형상칸) ·
* 알약 색 · 3D · 검사. 흐린 칸 = 처음 값(「기본」) · 진한 칸 = 바꾼 값 · [처음 값으로] = 그 종류 반영 지움.
* 칸 손질 = `M02_SO_Def_Reflect` · 검사 글 = `M02_SO_Def_Check`(서버 짝) · 「종류별」 탭이 같은 칸(`reflectCells`)을 씀.
* 칸 손질 = `M01_SO_Def_Reflect` · 검사 글 = `M01_SO_Def_Check`(서버 짝) · 「종류별」 탭이 같은 칸(`reflectCells`)을 씀.
* ========================================================================== */
import { createButton, createTag, el } from "@ui/ui_template_elements";
import type { CatalogRow } from "../../common_util/common_util_structure_catalog";
import { stepFamily, stepType, type StructDef, type TypeDef } from "./M02_SO_Def_Model";
import { stepFamily, stepType, type StructDef, type TypeDef } from "./M01_SO_Def_Model";
import { REVET_FORMS } from "../../B06_Section/logic/B06_Section_UI_Cross_Culvert_Const";
import {
isSet,
@@ -22,9 +22,9 @@ import {
setShapeOpt,
valueOf,
type ReflectField,
} from "./M02_SO_Def_Reflect";
import { checkBox, pickBox, textBox } from "./M02_SO_Def_Ui";
import { to } from "./M02_SO_Text";
} from "./M01_SO_Def_Reflect";
import { checkBox, pickBox, textBox } from "./M01_SO_Def_Ui";
import { to } from "./M01_SO_Text";
import { createText } from "@ui/ui_template_text";
type Pairs = ReadonlyArray<readonly [string, string]>;
@@ -1,12 +1,12 @@
/* =============================================================================
* M02_SO_Def_Ui.ts
* M01_SO_Def_Ui.ts
* 구조물 정의 편집 화면(PLAN 48-2)의 작은 입력 부품 — 글 · 숫자 · 체크 · 고르기 · 위아래 단추.
* 값은 받은 손잡이로 사본만 고침 · 글은 칸을 떠날 때(`change`) 다시 그림(초점 안 끊김).
* ========================================================================== */
import { createButton, el } from "@ui/ui_template_elements";
import { step } from "./M02_SO_Def_Model";
import { to } from "./M02_SO_Text";
import { step } from "./M01_SO_Def_Model";
import { to } from "./M01_SO_Text";
import { createText } from "@ui/ui_template_text";
import { createCheckbox } from "@ui/ui_template_checkbox";
@@ -17,12 +17,12 @@ from pydantic import ValidationError
from B05_Profile import B05_Profile_Structures_Schema as schema
from common_util.common_util_json import atomic_write_json
from common_util.common_util_time import utc_from_timestamp
from M01_MasterData.StructOptions.M01_SO_Check import catalog_errors
from M02_MasterTemplete import M02_MasterTemplete_Store as store
from M02_MasterTemplete.StructOptions.M02_SO_Check import catalog_errors
FILE = "구조물정의.json"
HISTORY = "구조물정의_이력"
# 반영 · 부품 = 구조물 표 칸(322-2 · 없으면 처음값 · 검사 = `M02_SO_Check`)
# 반영 · 부품 = 구조물 표 칸(322-2 · 없으면 처음값 · 검사 = `M01_SO_Check`)
TOP = {"판", "schema_version", "comment", "구조물군", "동작", "types", "반영", "부품"}
SECTIONS = {"종류": dict, "표시": dict, "그룹": dict, "배치": dict, "규칙": list}
SPOT = ("줄", "칸", "너비")
@@ -180,8 +180,8 @@ def _rule_errors(doc: dict[str, Any], keys: dict[str, dict[str, Any]]) -> list[s
def check(doc: Any, before: dict[str, Any] | None = None) -> list[str]:
"""정의 한 벌 검사 — 틀린 것 목록(빈 목록 = 통과). `before` = 지금 판(만든 뒤 고정 · 322-2)."""
from M02_MasterTemplete.StructOptions import M02_SO_Groups as groups
from M02_MasterTemplete.StructOptions import M02_SO_Options as options
from M01_MasterData.StructOptions import M01_SO_Groups as groups
from M01_MasterData.StructOptions import M01_SO_Options as options
if not isinstance(doc, dict):
return ["정의는 묶음이어야 함"]
@@ -1,6 +1,6 @@
"""M02 구조물 옵션 그룹 — 구조물 종류 안에 이름 붙은 묶음(PLAN 46-2).
정본 = 구조물 정의 한 벌(`M02_SO_Definition` · PLAN 48-1)의 「그룹」 칸 =
정본 = 구조물 정의 한 벌(`M01_SO_Definition` · PLAN 48-1)의 「그룹」 칸 =
`{type_id: [{"id": "g1a2b3c", "이름": "유입구 기슭막이", "옵션": [...], "형상"?: {...}}]}`
— 없는 종류 = 그룹 없음 · 빈 그룹(옵션 0)도 그룹 · 형상 = 길이 · 높이 · 전 · 후 받기 + 뜻.
@@ -26,7 +26,7 @@ logger = logging.getLogger(__name__)
def _load() -> tuple[dict[str, Any], str]:
"""(그룹 표 · 판) — 정의 한 벌(`M02_SO_Definition`)의 「그룹」 칸 · 판 = 정의 판 글."""
"""(그룹 표 · 판) — 정의 한 벌(`M01_SO_Definition`)의 「그룹」 칸 · 판 = 정의 판 글."""
doc = load_definition()
return doc.get("그룹") or {}, str(doc.get("판", 1))
@@ -144,7 +144,7 @@ def _clean(groups: Any, keys: dict[str, set[str]] | None = None) -> dict[str, li
def save(groups: Any, version: str) -> dict[str, Any]:
"""고쳐 씀 — 판이 같을 때만. 돌려주는 것 = 새 `listing()`."""
from M02_MasterTemplete.StructOptions.M02_SO_Definition import save_sections
from M01_MasterData.StructOptions.M01_SO_Definition import save_sections
save_sections({"그룹": _clean(groups)}, version)
return listing()
@@ -1,16 +1,16 @@
/* =============================================================================
* M02_SO_Groups.ts
* M01_SO_Groups.ts
* 구조물 정의 화면의 **옵션 그룹** 부품(PLAN 46-2 · 48-2) — 고른 종류의 그룹 목록
* (이름 · 위로 · 아래로 · 지우기 · 형상 칸 길이 · 높이 · 전 · 후 받기 켬끔과 뜻 · [그룹 추가]) ·
* 옵션 줄마다 「들어갈 자리」 고르기(본체 · 그룹).
* 값은 화면이 쥔 고칠 사본에만 — 저장은 화면 [저장](`M02_SO_Def.ts`).
* 그룹 하나 = 프로젝트 B05 · B06 폼의 보조 컨테이너 하나 · 옵션이 없어도 됨(서버 `M02_SO_Groups.py`).
* 값은 화면이 쥔 고칠 사본에만 — 저장은 화면 [저장](`M01_SO_Def.ts`).
* 그룹 하나 = 프로젝트 B05 · B06 폼의 보조 컨테이너 하나 · 옵션이 없어도 됨(서버 `M01_SO_Groups.py`).
* ========================================================================== */
import { createButton, el, showConfirmDialog } from "@ui/ui_template_elements";
import { SHAPE_KEYS, type GroupDef } from "./M02_SO_Def_Model";
import { checkBox, textBox } from "./M02_SO_Def_Ui";
import { to } from "./M02_SO_Text";
import { SHAPE_KEYS, type GroupDef } from "./M01_SO_Def_Model";
import { checkBox, textBox } from "./M01_SO_Def_Ui";
import { to } from "./M01_SO_Text";
import { createText } from "@ui/ui_template_text";
import { createEmpty } from "@ui/ui_template_empty";
@@ -1,6 +1,6 @@
"""M02 구조물 옵션 보이기 — 구조물 종류마다 B05/B06 폼에 보일 옵션을 사용자가 체크.
정본 = 구조물 정의(`M02_SO_Definition` · PLAN 48-1) 「표시」 칸 = `{type_id: {option_key: false}}`
정본 = 구조물 정의(`M01_SO_Definition` · PLAN 48-1) 「표시」 칸 = `{type_id: {option_key: false}}`
— 없는 종류 · 키는 보임.
저장은 **숨김(false)만** 남김 — 「모두 보임」 = `{}`.
옵션 정의 · 옛 값은 그대로 — 폼이 그리는 것만 갈림(`GET /api/projects/structure-types` `visible`).
@@ -22,8 +22,8 @@ from B05_Profile.B05_Profile_Structures_Schema import (
load_structure_types,
registry_schema_version,
)
from M01_MasterData.StructOptions.M01_SO_Groups import groups_of
from M02_MasterTemplete import M02_MasterTemplete_Store as store
from M02_MasterTemplete.StructOptions.M02_SO_Groups import groups_of
logger = logging.getLogger(__name__)
@@ -35,7 +35,7 @@ class OptionWithVisible(StructureOptionField):
class OptionGroup(BaseModel):
"""옵션 그룹 한 개(PLAN 46-2 · `M02_SO_Groups`) — 폼의 보조 컨테이너 하나 · 빈 옵션도 됨."""
"""옵션 그룹 한 개(PLAN 46-2 · `M01_SO_Groups`) — 폼의 보조 컨테이너 하나 · 빈 옵션도 됨."""
id: str
name: str
@@ -54,7 +54,7 @@ class TypesWithVisible(StructureTypesResponse):
def _load() -> tuple[dict[str, Any], str]:
"""(표시 표 · 판) — 정의 한 벌(`M02_SO_Definition`)의 「표시」 칸 · 판 = 정의 판 글."""
"""(표시 표 · 판) — 정의 한 벌(`M01_SO_Definition`)의 「표시」 칸 · 판 = 정의 판 글."""
doc = load_definition()
return doc.get("표시") or {}, str(doc.get("판", 1))
@@ -155,7 +155,7 @@ def _clean(shown: Any, keys: dict[str, set[str]] | None = None) -> dict[str, dic
def save(shown: Any, version: str) -> dict[str, Any]:
"""고쳐 씀 — 판이 같을 때만. 돌려주는 것 = 새 `listing()`."""
from M02_MasterTemplete.StructOptions.M02_SO_Definition import save_sections
from M01_MasterData.StructOptions.M01_SO_Definition import save_sections
save_sections({"표시": _clean(shown)}, version)
return listing()
@@ -1,15 +1,15 @@
/* =============================================================================
* M02_SO_Options.ts
* M01_SO_Options.ts
* 좌측 「구조물 옵션 정의」 줄(구조물 집계 양식 아래 별도 · 시스템 층) — 누르면 메인 칸에
* 정의 편집 화면(PLAN 48-2 · `M02_SO_Def.ts`) · 고쳐 씀은 시스템 관리자만 · 다른 역할은 읽기만.
* 정의 편집 화면(PLAN 48-2 · `M01_SO_Def.ts`) · 고쳐 씀은 시스템 관리자만 · 다른 역할은 읽기만.
* 옛 「보이기 · 그룹」 화면(46장)은 정의 화면의 옵션 줄 「보이기」 · 그룹 칸으로 들어감.
* ========================================================================== */
import { el } from "@ui/ui_template_elements";
import { openDefScreen } from "./M02_SO_Def";
import { openDefScreen } from "./M01_SO_Def";
import "@ui/ui_template_card.css";
import "./M02_SO_Style.css";
import { to } from "./M02_SO_Text";
import "./M01_SO_Style.css";
import { to } from "./M01_SO_Text";
export interface OptionsSectionOptions {
isAdmin: boolean;
@@ -1,4 +1,4 @@
"""M02 구조물 옵션 보이기 · 그룹 · 정의 길 — 정본 `M02_SO_Definition.py`(PLAN 48-1) 한 벌.
"""M02 구조물 옵션 보이기 · 그룹 · 정의 길 — 정본 `M01_SO_Definition.py`(PLAN 48-1) 한 벌.
`router` = 고쳐 씀 · 관리 읽기(`main.py` 가 `system_admin_only` 로 붙임) ·
`read_router` = 읽기만(로그인 누구나 · `main.py` 가 `protected` 로 붙임) · 정의 쓰기는 여기서
@@ -14,14 +14,14 @@ from pydantic import BaseModel
from B05_Profile.B05_Profile_Structures_Schema import definition_version
from common_util.common_util_auth import verify_session
from M01_MasterData.StructOptions import M01_SO_Definition as definition
from M01_MasterData.StructOptions import M01_SO_Groups as groups
from M01_MasterData.StructOptions import M01_SO_Options as options
from M02_MasterTemplete import M02_Layer_Access as access
from M02_MasterTemplete import M02_MasterTemplete_Store as store
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
from M02_MasterTemplete.StructOptions import M02_SO_Groups as groups
from M02_MasterTemplete.StructOptions import M02_SO_Options as options
router = APIRouter(prefix="/api/m02", tags=["M02 MasterTemplete"])
read_router = APIRouter(prefix="/api/m02", tags=["M02 MasterTemplete"])
router = APIRouter(prefix="/api/m01", tags=["M01 MasterData"])
read_router = APIRouter(prefix="/api/m01", tags=["M01 MasterData"])
class OptionsBody(BaseModel):
@@ -1,5 +1,5 @@
/* =============================================================================
* M02_SO_Text.ts
* M01_SO_Text.ts
* 좌측 「구조물 옵션 보이기」 줄 · 상세 화면(보이기 · 그룹) 글자 — [한국어, 영어]
* ========================================================================== */
+1 -1
View File
@@ -233,7 +233,7 @@ def rename_moved(base: Path, wanted: dict[str, tuple[str, dict[str, Any]]]) -> l
def group_names() -> dict[str, str]:
"""옵션 그룹 id → 이름(지금 정의) — 복사본 manifest `그룹` 으로 굳힘(142-2)."""
from M02_MasterTemplete.StructOptions.M02_SO_Groups import groups_of
from M01_MasterData.StructOptions.M01_SO_Groups import groups_of
return {g["id"]: g["name"] for rows in groups_of().values() for g in rows}
@@ -5,7 +5,7 @@
* ========================================================================== */
import { createSelectField } from "@ui/ui_template_elements";
import { fetchStructureDef } from "./StructOptions/M02_SO_Api";
import { fetchStructureDef } from "../M01_MasterData/StructOptions/M01_SO_Api";
import { precomboClasses } from "./M02_MasterTemplete_UI_Side_Precombo";
import { tc } from "./M02_MasterTemplete_Labor_Text";
@@ -33,7 +33,7 @@ import { openStandardSheet } from "./M02_MasterTemplete_Labor_Sheet";
import type { LaborFixed, LaborRef } from "./M02_MasterTemplete_Labor_Calc";
import { tc } from "./M02_MasterTemplete_Labor_Text";
import { precomboClasses } from "./M02_MasterTemplete_UI_Side_Precombo";
import { fetchStructureDef } from "./StructOptions/M02_SO_Api";
import { fetchStructureDef } from "../M01_MasterData/StructOptions/M01_SO_Api";
import "../M01_MasterData/M01_MasterData_UI_Logic_Style.css"; // 창 겉틀
import "./M02_MasterTemplete_Labor.css";
import { openModal } from "@ui/ui_template_modal";
@@ -9,7 +9,7 @@
import type { TreeMenuItem } from "@ui/ui_template_tree";
import type { Kind } from "./M02_MasterTemplete_Api_Fetch";
import type { StructDef } from "./StructOptions/M02_SO_Def_Model";
import type { StructDef } from "../M01_MasterData/StructOptions/M01_SO_Def_Model";
import { tc } from "./M02_MasterTemplete_Labor_Text";
import type { Selection } from "./M02_MasterTemplete_UI_Main";
import {
+1 -1
View File
@@ -150,9 +150,9 @@ def _with_group_items(items: list[dict[str, Any]], project_root=None) -> list[di
복사본 `{구조물 id}__{그룹 id}`. 그룹 = 지금 정의 + 복사본에 굳힌 정의(142-2 · 이름 · 사라진
그룹도) · 미지정 그룹 = 「미지정」 알림에 셈."""
from common_util.common_util_summary_item import GROUP_JOIN
from M01_MasterData.StructOptions.M01_SO_Groups import groups_of
from M02_MasterTemplete.M02_Item_Snapshot import copied_groups
from M02_MasterTemplete.M02_Table_Fill_Spec import container_rows
from M02_MasterTemplete.StructOptions.M02_SO_Groups import groups_of
defined = groups_of()
out: list[dict[str, Any]] = []
+3 -3
View File
@@ -20,9 +20,9 @@ export class StaleError extends Error {
}
}
/** `/api/m02` 아래 길 부름 — 409 = StaleError · 그 밖 실패 = 서버 까닭 글(하위 폴더도 씀) */
export async function call<T>(path: string, init: RequestInit = {}): Promise<T> {
const response = await fetch(`${API_BASE_URL}/m02${path}`, {
/** `/api/m02` 아래 길 부름(`base` = 다른 묶음 · M01 구조물 정의 `/m01`) — 409 = StaleError · 그 밖 실패 = 서버 까닭 글(하위 폴더도 씀) */
export async function call<T>(path: string, init: RequestInit = {}, base = "/m02"): Promise<T> {
const response = await fetch(`${API_BASE_URL}${base}${path}`, {
credentials: "include",
headers: { "Content-Type": "application/json" },
...init,
+1 -1
View File
@@ -71,7 +71,7 @@ def parse_summary_item(value: Any) -> dict[str, Any] | None:
return {**out, "spec": spec.strip()} if spec is not None else out
#: 옵션 그룹 id(PLAN 46 · `M02_SO_Groups.GROUP_ID` 와 같은 규칙)
#: 옵션 그룹 id(PLAN 46 · `M01_SO_Groups.GROUP_ID` 와 같은 규칙)
_GROUP_ID = re.compile(r"^g[0-9a-z]{1,16}$")
#: 그룹 복사본 이름 잇개 — `{구조물 id}__{그룹 id}`(구조물 id 는 hex · 관은 `pipe@측점`)
GROUP_JOIN = "__"
+5 -5
View File
@@ -105,8 +105,8 @@ from M02_MasterTemplete.M02_MasterTemplete_Router_Drawing import router as m02_d
from M02_MasterTemplete.M02_MasterTemplete_Router_Items import router as m02_items_router
from M02_MasterTemplete.M02_MasterTemplete_Router_Layers import router as m02_layers_router
from M02_MasterTemplete.M02_Project_Items_Router import router as m02_project_items_router
from M02_MasterTemplete.StructOptions.M02_SO_Router import read_router as m02_so_read_router
from M02_MasterTemplete.StructOptions.M02_SO_Router import router as m02_so_router
from M01_MasterData.StructOptions.M01_SO_Router import read_router as m01_so_read_router
from M01_MasterData.StructOptions.M01_SO_Router import router as m01_so_router
from common_util.common_util_audit import note_api_call, record_call_burst
from common_util.common_util_auth import (
require_company,
@@ -557,9 +557,9 @@ app.include_router(
dependencies=protected,
)
# 마스터 템플릿 층(시스템·회사·개인·프로젝트)·도면 길은 로그인만(권한은 길 안에서) · 옛 시스템 전용 길은 걷음(894).
# 구조물 옵션 보이기 · 그룹(PLAN 46) — 고쳐 씀은 시스템 관리자 · 읽기는 로그인만
app.include_router(m02_so_router, dependencies=system_admin_only)
app.include_router(m02_so_read_router, dependencies=protected)
# M01 구조물 정의 · 옵션 보이기 · 그룹(PLAN 46 · 859-5) — 고쳐 씀은 시스템 관리자 · 읽기는 로그인만
app.include_router(m01_so_router, dependencies=system_admin_only)
app.include_router(m01_so_read_router, dependencies=protected)
app.include_router(m02_layers_router, dependencies=protected)
app.include_router(m02_items_router, dependencies=protected)
app.include_router(m02_combos_router, dependencies=protected)
+4 -4
View File
@@ -1,4 +1,4 @@
/* PLAN 322-2 구조물 표 검사 · 편집 헬퍼 — 진짜 `M02_SO_Def_Check.ts` · `M02_SO_Def_Reflect.ts` ·
/* PLAN 322-2 구조물 표 검사 · 편집 헬퍼 — 진짜 `M01_SO_Def_Check.ts` · `M01_SO_Def_Reflect.ts` ·
* `design_structure_spec.ts` 를 그 자리에서 트랜스파일해 Node 로 돌림 · 결과 = 표준출력 JSON 한 벌.
* 입력 = argv[2] JSON `{cases: {이름: [정의, 앞 판|null]}, definition}`. 짝 = `test_322_2_check_mirror.py`.
*/
@@ -33,9 +33,9 @@ function load(file) {
return box.exports;
}
const SO = (name) => path.join(ROOT, "M02_MasterTemplete", "StructOptions", `${name}.ts`);
const check = load(SO("M02_SO_Def_Check"));
const reflect = load(SO("M02_SO_Def_Reflect"));
const SO = (name) => path.join(ROOT, "M01_MasterData", "StructOptions", `${name}.ts`);
const check = load(SO("M01_SO_Def_Check"));
const reflect = load(SO("M01_SO_Def_Reflect"));
const spec = load(path.join(ROOT, "A00_Common", "design", "logic", "design_structure_spec.ts"));
const { STRUCTURE_SPECS } = load(
path.join(ROOT, "A00_Common", "design", "logic", "design_structure_pipe.ts"),
+4 -4
View File
@@ -1,4 +1,4 @@
/* PLAN 323-7 종류 더하기 헬퍼 — 진짜 `M02_SO_Def_Add.ts`(본보기 복사) · 구조물 표 · 측점 계획 · 형상 얹기 · 벽 단 ·
/* PLAN 323-7 종류 더하기 헬퍼 — 진짜 `M01_SO_Def_Add.ts`(본보기 복사) · 구조물 표 · 측점 계획 · 형상 얹기 · 벽 단 ·
* 명세 고르기 · M02 검사를 그 자리에서 트랜스파일해 Node 로 돌림(마스터는 읽기만 · 사본에서 더함) · 결과 = JSON.
* 짝 = `test_323_7_new_type.py`(파이썬 검사 · 표 · 벽 제원이 같은 사본을 읽음).
*/
@@ -35,12 +35,12 @@ function load(file) {
}
const C = (name) => path.join(ROOT, "common_util", `${name}.ts`);
const M = (name) => path.join(ROOT, "M02_MasterTemplete", "StructOptions", `${name}.ts`);
const M = (name) => path.join(ROOT, "M01_MasterData", "StructOptions", `${name}.ts`);
const master = JSON.parse(
fs.readFileSync(path.join(ROOT, "resources", "master_template", "구조물정의.json"), "utf8"),
);
const def = JSON.parse(JSON.stringify(master));
const add = load(M("M02_SO_Def_Add"));
const add = load(M("M01_SO_Def_Add"));
const catalog = load(C("common_util_structure_catalog"));
const station = load(C("common_util_structure_station"));
const attach = load(C("common_util_structure_attach"));
@@ -48,7 +48,7 @@ const walls = load(C("common_util_structure_walls"));
const pipeSpecs = load(
path.join(ROOT, "A00_Common", "design", "logic", "design_structure_pipe.ts"),
);
const check = load(M("M02_SO_Def_Check"));
const check = load(M("M01_SO_Def_Check"));
const out = {};
out.templates = add.templates(def).map(([key]) => key);
+2 -2
View File
@@ -1,11 +1,11 @@
/* M02 구조물 정의 편집 화면 자료 손질(`M02_SO_Def_Model.ts` · PLAN 48-2) 단위검증 헬퍼 —
/* M02 구조물 정의 편집 화면 자료 손질(`M01_SO_Def_Model.ts` · PLAN 48-2) 단위검증 헬퍼 —
* TS 를 그 자리에서 트랜스파일해 Node 로 돌리고 결과를 JSON 으로 냄(pytest 가 판정). */
const fs = require("fs");
const path = require("path");
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
const source = fs.readFileSync(
path.join(__dirname, "..", "..", "M02_MasterTemplete", "StructOptions", "M02_SO_Def_Model.ts"),
path.join(__dirname, "..", "..", "M01_MasterData", "StructOptions", "M01_SO_Def_Model.ts"),
"utf8",
);
const js = ts.transpileModule(source, {
+2 -2
View File
@@ -1,4 +1,4 @@
/* M02 구조물 명세 이름 고치기(`M02_SO_Def_Spec_Model.ts` · PLAN 52-11) 단위검증 헬퍼 —
/* M02 구조물 명세 이름 고치기(`M01_SO_Def_Spec_Model.ts` · PLAN 52-11) 단위검증 헬퍼 —
* TS 를 그 자리에서 트랜스파일해 Node 로 돌리고 결과를 JSON 으로 냄(pytest 가 판정).
* 정의는 진짜 `구조물정의.json` 을 읽어 메모리 사본만 고침(파일 쓰기 없음). */
const fs = require("fs");
@@ -25,7 +25,7 @@ const load = (...parts) => {
new Function("exports", "module", "require", js)(box.exports, box, near);
return box.exports;
};
const m = load("M02_MasterTemplete", "StructOptions", "M02_SO_Def_Spec_Model.ts");
const m = load("M01_MasterData", "StructOptions", "M01_SO_Def_Spec_Model.ts");
const { PIPE_SPEC } = load("A00_Common", "design", "logic", "design_structure_pipe.ts");
const real = () =>
JSON.parse(
@@ -24,8 +24,8 @@ import pytest
from B06_Section.B06_Section_Schema import CrossSectionPatch
from B08_Quantity import B08_Quantity_Router_Summary as summary
from M01_MasterData.StructOptions import M01_SO_Definition as definition
from M02_MasterTemplete import M02_Item_Snapshot as snapshots
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
ROOT = Path(__file__).resolve().parents[2]
FIXTURES = Path(__file__).parent / "fixtures"
@@ -15,8 +15,8 @@ import subprocess
import pytest
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible
from M01_MasterData.StructOptions import M01_SO_Definition as definition
from M01_MasterData.StructOptions.M01_SO_Options import with_visible
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.abspath(os.path.join(HERE, "..", ".."))
@@ -20,8 +20,8 @@ from test_121_b08_material_sheets import SUMMARY, UNITS, _run_ts
from B08_Quantity import B08_Quantity_Router_Material as router_mod
from B08_Quantity import B08_Quantity_Router_Summary as summary_mod
from B08_Quantity.B08_Quantity_Material_Calc import clean_overrides, compute, finish
from M01_MasterData.StructOptions import M01_SO_Definition as definition
from M02_MasterTemplete import M02_Item_Snapshot as snapshots
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
ROOT = Path(__file__).resolve().parents[2]
FIXTURES = Path(__file__).parent / "fixtures"
@@ -42,10 +42,3 @@ def test_이름표_단추는_작은_단추_틀_흐림은_글에만():
assert "height: var(--b05-control-h)" in small and "padding-block: 0" in small
legend = _rule(".b05-structure__group > legend {")
assert "opacity" not in legend and "currentColor 80%" in legend
def test_M02_미리보기_이름표_단추도_작은_단추_틀():
css = (ROOT / "M02_MasterTemplete" / "StructOptions" / "M02_SO_Style.css").read_text("utf-8")
at = css.index(".m02-sod__block .b05-structure__group > legend > button")
rule = css[at : css.index("}", at)]
assert "height: 26px" in rule and "padding-block: 0" in rule
@@ -19,8 +19,8 @@ from pathlib import Path
import pytest
from B08_Quantity import B08_Quantity_Router_Summary as summary
from M01_MasterData.StructOptions import M01_SO_Definition as definition
from M02_MasterTemplete import M02_Item_Snapshot as snapshots
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
ROOT = Path(__file__).resolve().parents[2]
@@ -10,8 +10,8 @@ import json
from pathlib import Path
from B08_Quantity import B08_Quantity_Router_Summary as summary
from M01_MasterData.StructOptions import M01_SO_Definition as definition
from M02_MasterTemplete import M02_Item_Snapshot as snapshots
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
ITEM = {"layer": "system", "owner": None, "key": "SS000001", "name": "견본"}
POINTS = [
@@ -18,10 +18,10 @@ import pytest
from B08_Quantity import B08_Quantity_Router_Summary as summary
from config import config_system
from M01_MasterData.StructOptions import M01_SO_Definition as definition
from M02_MasterTemplete import M02_Item_Copy as copies
from M02_MasterTemplete import M02_Item_Snapshot as snap
from M02_MasterTemplete import M02_Template_Layers as layers
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
from resources.tester.helper_m02_master_sample import SAMPLE
ROOT = Path(__file__).resolve().parents[2]
+1 -1
View File
@@ -13,9 +13,9 @@ import asyncio
from pathlib import Path
from B08_Quantity import B08_Quantity_Router_Summary as summary
from M01_MasterData.StructOptions import M01_SO_Definition as definition
from M02_MasterTemplete import M02_Item_Snapshot as snap
from M02_MasterTemplete import M02_Project_Items_Router as items_router
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
from resources.tester.test_154_2_b08_direct_link import ( # noqa: F401 — 시험 저장소
MS,
PIPE,
+1 -1
View File
@@ -26,7 +26,7 @@ from B07_DesignDetail.B07_DesignDetail_Engine_Cad_CulvertNote import ( # noqa:
structure_note_lines,
with_option_lines,
)
from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible # noqa: E402
from M01_MasterData.StructOptions.M01_SO_Options import with_visible # noqa: E402
pytestmark = pytest.mark.skipif(
not (ROOT / "config" / "node_modules").is_dir(), reason="프론트엔드 의존성 미설치"
@@ -19,8 +19,8 @@ from B05_Profile.B05_Profile_Structures_Schema import structure_type_map
from B06_Section import B06_Section_Engine_Culvert as culvert
from B08_Quantity import B08_Quantity_Router_Summary as summary
from common_util.common_util_drainage_pipes import PipePoint
from M01_MasterData.StructOptions import M01_SO_Definition as definition
from M02_MasterTemplete import M02_Item_Snapshot as snapshots
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
ROOT = Path(__file__).resolve().parents[2]
TSC = ROOT / "config" / "node_modules" / "typescript" / "bin" / "tsc"
+1 -1
View File
@@ -30,7 +30,7 @@ from B06_Section.B06_Section_Engine_Structures_Wall import attach_wall_specs, wa
from B06_Section.B06_Section_Engine_Tilt import attach_underdrain_specs, load_underdrains
from common_util.common_util_drainage_pipes import parse_pipe_points
from common_util.common_util_structure_pavement import attach_pavement_structures
from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible
from M01_MasterData.StructOptions.M01_SO_Options import with_visible
HERE = Path(__file__).parent
ROOT = HERE.parent.parent
+4 -4
View File
@@ -1,7 +1,7 @@
"""PLAN 322-0 ③ — 판 확인: 서버 관 기본값 · 판 읽기 길이 정의 사본을 바로 따름(서버 다시 켜기 없음).
- `_registry_defaults` = 정의 파일이 바뀌면 다음 부름부터 새 기본값(옛 lru = 서버 다시 켤 때까지 옛 값).
- `GET /api/m02/structure-definition/version` = 지금 판 `{판}` 만(화면 종류 캐시가 판을 볼 때 · 한 벌 안 받음).
- `GET /api/m01/structure-definition/version` = 지금 판 `{판}` 만(화면 종류 캐시가 판을 볼 때 · 한 벌 안 받음).
화면 캐시 쪽은 `test_322_0_golden.py::test_type_cache_follows_definition_version`.
"""
@@ -17,7 +17,7 @@ from fastapi.testclient import TestClient
from B05_Profile import B05_Profile_Structures_Schema as schema
from B06_Section.B06_Section_Engine_Culvert import _registry_defaults
from common_util.common_util_auth import verify_session
from M02_MasterTemplete.StructOptions.M02_SO_Router import read_router
from M01_MasterData.StructOptions.M01_SO_Router import read_router
@pytest.fixture
@@ -53,6 +53,6 @@ def test_version_endpoint_reads_current_version(copy: Path) -> None:
app.dependency_overrides[verify_session] = lambda: {"role": "USER", "user_id": 2}
client = TestClient(app)
now = json.loads(copy.read_text("utf-8"))["판"]
assert client.get("/api/m02/structure-definition/version").json() == {"판": now}
assert client.get("/api/m01/structure-definition/version").json() == {"판": now}
_rewrite(copy, lambda doc: doc.update(판=now + 3))
assert client.get("/api/m02/structure-definition/version").json() == {"판": now + 3}
assert client.get("/api/m01/structure-definition/version").json() == {"판": now + 3}
+3 -3
View File
@@ -24,12 +24,12 @@ from fastapi.testclient import TestClient
from B05_Profile import B05_Profile_Structures_Schema as schema
from common_util.common_util_auth import verify_session
from common_util.common_util_structure_catalog import catalog
from M02_MasterTemplete.StructOptions.M02_SO_Check import catalog_errors
from M02_MasterTemplete.StructOptions.M02_SO_Router import read_router
from M01_MasterData.StructOptions.M01_SO_Check import catalog_errors
from M01_MasterData.StructOptions.M01_SO_Router import read_router
HERE = Path(__file__).parent
ROOT = HERE.parent.parent
URL = "/api/m02/structure-definition"
URL = "/api/m01/structure-definition"
ADMIN = {"role": "SYSTEM_ADMIN", "user_id": 1}
pytestmark = pytest.mark.skipif(
+1 -1
View File
@@ -20,7 +20,7 @@ from B05_Profile.B05_Profile_Engine_Sections import resolve_extra_stations
from B05_Profile.B05_Profile_Structures_Schema import StructureInstance, load_definition
from common_util.common_util_drainage_pipes import parse_pipe_points
from common_util.common_util_structure_station import plan_stations
from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible
from M01_MasterData.StructOptions.M01_SO_Options import with_visible
HERE = Path(__file__).parent
ROOT = HERE.parent.parent
+1 -1
View File
@@ -21,7 +21,7 @@ from B05_Profile.B05_Profile_Structures_Schema import StructureInstance, load_de
from B06_Section.B06_Section_Engine_Attach import attach_shapes
from common_util.common_util_drainage_pipes import parse_pipe_points
from common_util.common_util_structure_catalog import catalog
from M02_MasterTemplete.StructOptions.M02_SO_Options import with_visible
from M01_MasterData.StructOptions.M01_SO_Options import with_visible
HERE = Path(__file__).parent
ROOT = HERE.parent.parent
+1 -1
View File
@@ -17,7 +17,7 @@ from B05_Profile import B05_Profile_Structures_Schema as schema
from B05_Profile.B05_Profile_Structures_Schema import StructureInstance
from B06_Section.B06_Section_Engine_Structures_Wall import wall_specs_from
from common_util import common_util_structure_catalog as catalog
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
from M01_MasterData.StructOptions import M01_SO_Definition as definition
HERE = Path(__file__).parent
ROOT = HERE.parent.parent
@@ -46,7 +46,7 @@ def test_컨테이너_맹암거_높이_경사_손_입력():
def test_정의_검사_통과():
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
from M01_MasterData.StructOptions import M01_SO_Definition as definition
assert definition.check(load_definition()) == []
+1 -1
View File
@@ -11,7 +11,7 @@ import subprocess
from B05_Profile.B05_Profile_Structures_Schema import structure_type_map
from common_util.common_util_structure_catalog import load_parts
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
from M01_MasterData.StructOptions import M01_SO_Definition as definition
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(os.path.dirname(HERE))
+4 -4
View File
@@ -11,9 +11,9 @@ from pathlib import Path
from B05_Profile.B05_Profile_Structures_Schema import DEFINITION_PATH, load_structure_types
from common_util.common_util_structure_catalog import catalog_row
from M01_MasterData.StructOptions import M01_SO_Definition
from M01_MasterData.StructOptions.M01_SO_Groups import groups_of
from M02_MasterTemplete.M02_Table_Fill import _with_group_items
from M02_MasterTemplete.StructOptions import M02_SO_Definition
from M02_MasterTemplete.StructOptions.M02_SO_Groups import groups_of
KINDS = {
"spoil_bank": ("유용토운반작업장(사토장)", "사토장 부피", "gspoildetail"),
@@ -40,8 +40,8 @@ def test_컨테이너_상세_내용_하나_부피를_담음():
def test_정의_검사_통과_판_이력():
doc = json.loads(Path(DEFINITION_PATH).read_text("utf-8"))
assert M02_SO_Definition.check(doc) == []
assert M02_SO_Definition.history_path(doc["판"] - 1).is_file()
assert M01_SO_Definition.check(doc) == []
assert M01_SO_Definition.history_path(doc["판"] - 1).is_file()
def test_잇기는_그룹마다_집계_한_줄():
+5 -5
View File
@@ -13,9 +13,9 @@ from B05_Profile.B05_Profile_Structures_Schema import (
StructureInstance,
load_structure_types,
)
from M02_MasterTemplete.StructOptions import M02_SO_Definition
from M02_MasterTemplete.StructOptions.M02_SO_Groups import groups_of
from M02_MasterTemplete.StructOptions.M02_SO_Options import hidden_keys
from M01_MasterData.StructOptions import M01_SO_Definition
from M01_MasterData.StructOptions.M01_SO_Groups import groups_of
from M01_MasterData.StructOptions.M01_SO_Options import hidden_keys
TABLE = {
"soil_guard": (
@@ -87,5 +87,5 @@ def test_옛_값_저장_막지_않음():
def test_정의_검사_통과_판_이력():
doc = json.loads(Path(DEFINITION_PATH).read_text("utf-8"))
assert M02_SO_Definition.check(doc) == []
assert M02_SO_Definition.history_path(doc["판"] - 1).is_file()
assert M01_SO_Definition.check(doc) == []
assert M01_SO_Definition.history_path(doc["판"] - 1).is_file()
@@ -8,9 +8,9 @@ import json
from pathlib import Path
from B05_Profile.B05_Profile_Structures_Schema import DEFINITION_PATH, load_structure_types
from M01_MasterData.StructOptions import M01_SO_Definition
from M01_MasterData.StructOptions.M01_SO_Groups import groups_of
from M02_MasterTemplete.M02_Table_Fill import _with_group_items
from M02_MasterTemplete.StructOptions import M02_SO_Definition
from M02_MasterTemplete.StructOptions.M02_SO_Groups import groups_of
KINDS = {
"retaining_wall": "gretaindetail",
@@ -41,8 +41,8 @@ def test_C군_종류마다_컨테이너_하나_옵션_전부():
def test_정의_검사_통과_판_이력():
doc = json.loads(Path(DEFINITION_PATH).read_text("utf-8"))
assert M02_SO_Definition.check(doc) == []
assert M02_SO_Definition.history_path(doc["판"] - 1).is_file()
assert M01_SO_Definition.check(doc) == []
assert M01_SO_Definition.history_path(doc["판"] - 1).is_file()
def test_잇기는_컨테이너마다_집계_한_줄():
+6 -2
View File
@@ -71,8 +71,12 @@ def test_m02_borrowed_m01_classes_follow_parts():
def _m02_src(suffix: str) -> dict[str, str]:
out = {}
for sub in ("", "DataFlow", "StructOptions"):
out.update(_src(f"M02_MasterTemplete/{sub}".rstrip("/"), suffix))
for folder in (
"M02_MasterTemplete",
"M02_MasterTemplete/DataFlow",
"M01_MasterData/StructOptions",
):
out.update(_src(folder, suffix))
return out
@@ -14,7 +14,7 @@ import pytest
from B08_Quantity import B08_Quantity_Router_Summary as summary
from B09_Estimation.B09_Estimation_Bill_Items import structure_items
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
from M01_MasterData.StructOptions import M01_SO_Definition as definition
def _item(key: str) -> dict:
+1 -1
View File
@@ -19,9 +19,9 @@ from pathlib import Path
import pytest
from B08_Quantity import B08_Quantity_Router_Summary as summary
from M01_MasterData.StructOptions import M01_SO_Definition as definition
from M02_MasterTemplete import M02_Item_Snapshot as snapshots
from M02_MasterTemplete import M02_Template_Layers as layers
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
COMBO = {"layer": "system", "owner": None, "key": "SS000011", "name": "횡단배수 배관"}
OUT = {"layer": "company", "owner": "3", "key": "SC3-000001", "name": "기슭막이 메쌓기"}
+2 -2
View File
@@ -18,13 +18,13 @@ from fastapi.testclient import TestClient
from common_util.common_util_auth import verify_session
from config import config_system
from M01_MasterData.StructOptions import M01_SO_Router as so_router
from M02_MasterTemplete import M02_Item_Copy as copies
from M02_MasterTemplete import M02_MasterTemplete_Router_Items as items_router
from M02_MasterTemplete import M02_MasterTemplete_Router_Layers as layers_router
from M02_MasterTemplete import M02_MasterTemplete_Store as store
from M02_MasterTemplete import M02_MasterTemplete_Tree as tree
from M02_MasterTemplete import M02_Template_Layers as layers
from M02_MasterTemplete.StructOptions import M02_SO_Router as so_router
from resources.tester.helper_m02_master_sample import copy_master_sample
from resources.tester.test_item_copy_complete import ( # noqa: F401 — 복사본 world 고정물
FOLDER,
@@ -93,7 +93,7 @@ def test_빈_마스터에서_첫_화면_나무_새_항목_지우기(empty):
r["이름"] for r in client.get("/api/m02/layers/system/templates").json()["양식"]
]
assert client.get("/api/m02/layers/system/structures/numbers").json() == {}
assert client.get("/api/m02/structure-options").status_code == 200
assert client.get("/api/m01/structure-options").status_code == 200
assert client.get("/api/m02/items").json() == []
groups = client.get("/api/m02/items?all=1").json() # 고르기 모달 — 마스터 0
assert groups[0]["layer"] == "system" and groups[0]["items"] == []
+2 -2
View File
@@ -1,4 +1,4 @@
"""M02 구조물 정의 편집 화면 자료 손질(`M02_SO_Def_Model.ts` · PLAN 48-2) 단위검증.
"""M02 구조물 정의 편집 화면 자료 손질(`M01_SO_Def_Model.ts` · PLAN 48-2) 단위검증.
프론트에 JS 테스트 러너가 없어 Node 헬퍼(`helper_m02_so_def_model.cjs`)가 TS 를 트랜스파일해 돌리고
pytest 는 그 결과(JSON)를 판정.
@@ -6,7 +6,7 @@ pytest 는 그 결과(JSON)를 판정.
못박는 것
- 배치 격자: 안 정한 옵션은 차례대로 · 정한 자리 먼저 · 너비 ≤ 칸 수 · 안 씀 빠짐 · 겹침 찾음.
- 규칙: 없는 값 · 자기 자신 · 없는 하위 선택지 · 그러면 비었음 · 좁힌 선택지 밖 기본값은 틀린 줄
(서버 `M02_SO_Definition._rule_errors` 와 같은 뜻) · 고르기 아닌 상위는 값 검사 안 함.
(서버 `M01_SO_Definition._rule_errors` 와 같은 뜻) · 고르기 아닌 상위는 값 검사 안 함.
- 저장 전 검사: 깨끗한 정의 = 빈 목록 · 이름 겹침 · 배치 겹침 · 빈 선택지 = 까닭 글.
- 선택지 이름 바꿈 · 뺌은 그 옵션 기본값 · 같은 종류 규칙도 같이 고침.
- 순서: 구조물군 = 키 차례 · 종류 = 같은 군 안에서만.
+1 -1
View File
@@ -1,4 +1,4 @@
"""M02 구조물 명세 이름 고치기(`M02_SO_Def_Spec_Model.ts` · PLAN 52-11) 단위검증.
"""M02 구조물 명세 이름 고치기(`M01_SO_Def_Spec_Model.ts` · PLAN 52-11) 단위검증.
Node 헬퍼(`helper_m02_so_def_spec.cjs`)가 TS 를 트랜스파일해 진짜 정의 사본(메모리)으로 돌리고
pytest 는 그 결과(JSON)를 판정.
@@ -20,9 +20,9 @@ from fastapi.testclient import TestClient
from B05_Profile import B05_Profile_Structures_Schema as schema
from common_util.common_util_auth import verify_session
from M02_MasterTemplete.StructOptions.M02_SO_Router import read_router
from M01_MasterData.StructOptions.M01_SO_Router import read_router
URL = "/api/m02/structure-definition"
URL = "/api/m01/structure-definition"
ADMIN = {"role": "SYSTEM_ADMIN", "user_id": 1}
USER = {"role": "USER", "user_id": 2, "company_id": 1}
@@ -43,7 +43,7 @@ def _client(session: dict) -> TestClient:
def _screen_edit(doc: dict) -> dict:
"""화면이 하는 고침 한 벌 — `M02_SO_Def*.ts` 가 만드는 꼴 그대로."""
"""화면이 하는 고침 한 벌 — `M01_SO_Def*.ts` 가 만드는 꼴 그대로."""
pipe = next(t for t in doc["types"] if t["type_id"] == "pipe")
pipe["name"] = "배수관(고침)"
kind = next(o for o in pipe["options"] if o["key"] == "pipe_kind")
@@ -1,4 +1,4 @@
"""M02 구조물 정의 한 벌(`/api/m02/structure-definition` · PLAN 48-1).
"""M02 구조물 정의 한 벌(`/api/m01/structure-definition` · PLAN 48-1).
못박는 것
- 판 1 = 옛 레지스트리 그대로 옮김(37종 · 옵션 235 · 키 그대로) · 검사 통과.
@@ -22,10 +22,10 @@ from B05_Profile.B05_Profile_Structures_Repository import load_structures, save_
from B05_Profile.B05_Profile_Structures_Router import router as b05_router
from B05_Profile.B05_Profile_Structures_Schema import StructureInstance, load_structure_types
from common_util.common_util_auth import verify_session
from M02_MasterTemplete.StructOptions import M02_SO_Definition as definition
from M02_MasterTemplete.StructOptions.M02_SO_Router import read_router
from M01_MasterData.StructOptions import M01_SO_Definition as definition
from M01_MasterData.StructOptions.M01_SO_Router import read_router
URL = "/api/m02/structure-definition"
URL = "/api/m01/structure-definition"
TYPES = "/api/projects/structure-types"
ADMIN = {"role": "SYSTEM_ADMIN", "user_id": 1}
USER = {"role": "USER", "user_id": 2, "company_id": 1}
@@ -1,4 +1,4 @@
"""M02 구조물 옵션 그룹(`/api/m02/structure-option-groups` · 정의 「그룹」 칸 · PLAN 46-2).
"""M02 구조물 옵션 그룹(`/api/m01/structure-option-groups` · 정의 「그룹」 칸 · PLAN 46-2).
못박는 것
- 「그룹」 이 `{}` 면 그룹 없음 · `/structure-types` 종류마다 `groups: []`.
@@ -21,11 +21,11 @@ from fastapi.testclient import TestClient
from B05_Profile import B05_Profile_Structures_Schema as schema
from B05_Profile.B05_Profile_Structures_Router import router as b05_router
from B05_Profile.B05_Profile_Structures_Schema import load_structure_types
from M01_MasterData.StructOptions.M01_SO_Router import router as m02_router
from M02_MasterTemplete import M02_MasterTemplete_Store as store
from M02_MasterTemplete.StructOptions.M02_SO_Router import router as m02_router
ROOT = Path(__file__).resolve().parents[2]
URL = "/api/m02/structure-option-groups"
URL = "/api/m01/structure-option-groups"
TYPES = "/api/projects/structure-types"
@@ -100,12 +100,3 @@ def test_틀린_그룹은_422_낡은_판은_409(client) -> None:
assert client.put(URL, json={"판": "낡음", "그룹": {}}).status_code == 409
res = client.put(URL, json={"판": v1, "그룹": {}})
assert res.status_code == 200 and res.json()["그룹"] == {}
def test_좌측_정의_줄은_시스템_층에_늘_고쳐_씀은_시스템_관리자만() -> None:
"""PLAN 48-2 — 다른 역할은 읽기만(화면이 칸을 잠금 · 서버 PUT 403)."""
side = (ROOT / "M02_MasterTemplete/M02_MasterTemplete_UI_Side.ts").read_text("utf-8")
assert "section(options.title" not in side # 716-3 — 옵션 줄은 M01 로 옮겨 좌측 칸에서 뺌
folder = ROOT / "M02_MasterTemplete/StructOptions"
assert "buildGroupBlock(" in (folder / "M02_SO_Def.ts").read_text("utf-8")
assert "buildPlaceSelect(" in (folder / "M02_SO_Def_Options.ts").read_text("utf-8")
+3 -19
View File
@@ -1,4 +1,4 @@
"""M02 구조물 옵션 보이기(`/api/m02/structure-options` · 정의 「표시」 칸 · PLAN 48-1).
"""M02 구조물 옵션 보이기(`/api/m01/structure-options` · 정의 「표시」 칸 · PLAN 48-1).
못박는 것
- 「표시」 가 `{}` 면 `GET /api/projects/structure-types` 옵션이 모두 visible.
@@ -18,11 +18,11 @@ from fastapi.testclient import TestClient
from B05_Profile import B05_Profile_Structures_Schema as schema
from B05_Profile.B05_Profile_Structures_Router import router as b05_router
from B05_Profile.B05_Profile_Structures_Schema import load_structure_types
from M01_MasterData.StructOptions.M01_SO_Router import router as m02_router
from M02_MasterTemplete import M02_MasterTemplete_Store as store
from M02_MasterTemplete.StructOptions.M02_SO_Router import router as m02_router
ROOT = Path(__file__).resolve().parents[2]
URL = "/api/m02/structure-options"
URL = "/api/m01/structure-options"
TYPES = "/api/projects/structure-types"
@@ -107,22 +107,6 @@ def test_없는_종류_키_참거짓_아님은_422_낡은_판은_409(client) ->
assert client.get(URL).json()["판"] == v1
def test_좌측_줄은_구조물_집계_양식_아래_한_줄_같은_한_곳에서_지움() -> None:
side = (ROOT / "M02_MasterTemplete/M02_MasterTemplete_UI_Side.ts").read_text("utf-8")
# 716-3 — 옵션 줄은 M01 로 옮겨 좌측 칸에서 뺌(차례 = 일위대가 → 구조물 조합 → 도면 양식)
assert "options.title" not in side and "options.clear" not in side
order = side.split('className: "m02-side__lists ui-sidebar-panel",')[1].split("});")[0]
assert order.index("summary") < order.index("drawing,")
# 실무문서 칸은 걷음(732-1)
assert "practice" not in side
assert "matset" not in side
# 화면은 정의 한 벌로 읽고 씀(PLAN 48-2) · 보이기 체크는 정의 화면 옵션 줄
api = (ROOT / "M02_MasterTemplete/StructOptions/M02_SO_Api.ts").read_text("utf-8")
assert 'call("/structure-definition")' in api
ui = (ROOT / "M02_MasterTemplete/StructOptions/M02_SO_Def_Options.ts").read_text("utf-8")
assert 'o.phase === "detail"' in ui # B06 전용 표시
def test_숨긴_옵션은_필수_아님_저장이_안_막힘(client, tmp_path, monkeypatch) -> None:
"""B05 필수(기본값 없음) 옵션 — 보이면 막고 숨기면 저장됨(다른 필수는 그대로)."""
from B05_Profile import B05_Profile_Structures_Repository as repo
+2 -2
View File
@@ -14,11 +14,11 @@ from fastapi.testclient import TestClient
from common_util.common_util_auth import verify_session
from config import config_system
from M01_MasterData.StructOptions import M01_SO_Router as so_router
from M02_MasterTemplete import M02_MasterTemplete_Router_Items as items_router
from M02_MasterTemplete import M02_MasterTemplete_Router_Layers as layers_router
from M02_MasterTemplete import M02_MasterTemplete_Store as store
from M02_MasterTemplete import M02_Template_Layers as layers
from M02_MasterTemplete.StructOptions import M02_SO_Router as so_router
from resources.tester.test_m02_structure import write_sample_table
SYS = "/api/m02/layers/system"
@@ -57,7 +57,7 @@ def test_세_계정_모두_마스터_층_읽기_200(world, role):
f"{SYS}/templates/area/rv",
f"{SYS}/structures/numbers",
f"{SYS}/structure-combos",
f"{SYS}/structure-options",
"/api/m01/layers/system/structure-options",
):
assert client.get(url).status_code == 200, url
rows = client.get(f"{SYS}/templates").json()["양식"]
@@ -18,10 +18,10 @@ import pytest
from B05_Profile.B05_Profile_Structures_Schema import StructureInstance
from common_util.common_util_drainage_pipes import parse_pipe_points
from common_util.common_util_summary_item import parse_group_items
from M01_MasterData.StructOptions import M01_SO_Groups as groups
from M02_MasterTemplete import M02_Item_Snapshot as snap
from M02_MasterTemplete import M02_MasterTemplete_Store as store
from M02_MasterTemplete import M02_Table_Fill as fill
from M02_MasterTemplete.StructOptions import M02_SO_Groups as groups
from resources.tester.test_structures_summary_snapshot import ( # noqa: F401 — world 고정물
MS,
PIPE,
@@ -21,10 +21,10 @@ from common_util import common_util_initial_snapshot as initial
from common_util.common_util_drainage_pipes import PipePoint, parse_pipe_points
from common_util.common_util_summary_item import parse_summary_item
from config import config_system
from M01_MasterData.StructOptions import M01_SO_Groups as groups
from M02_MasterTemplete import M02_Item_Snapshot as snap
from M02_MasterTemplete import M02_Table_Fill as fill
from M02_MasterTemplete import M02_Template_Layers as layers
from M02_MasterTemplete.StructOptions import M02_SO_Groups as groups
from resources.tester.helper_m02_master_sample import SAMPLE
REAL = SAMPLE # 시험 안 견본(PLAN 26-5a) — 실제 마스터 안 읽음