feat(M02): 46-2 구조물 옵션 그룹 — 종류마다 이름 붙은 묶음 편집 · 정본 · /structure-types groups

- 정본 `resources/master_template/구조물옵션그룹.json` = {type_id: [{id, 이름, 옵션[]}]} · 빈 그룹 됨
- 길 GET · PUT /api/m02/structure-option-groups(시스템 관리자) · 검사(없는 종류 · 키 · 겹침 · 옵션 두 그룹 422 · 낡은 판 409)
- /api/projects/structure-types 종류마다 groups(차례 · 이름 · 옵션) · 깨진 표 = 그룹 없음
- 옵션 보이기 화면 = 그룹 목록(이름 · 위로 · 아래로 · 지우기 · 추가) + 옵션 줄 「들어갈 자리」(본체 · 그룹)
- 좌측 「구조물 옵션 보이기」 = 시스템 관리자만
- 시험 test_m02_structure_option_groups.py

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPcuokNm1ZR2kqgGGDfaJA
This commit is contained in:
2026-10-05 13:21:37 +09:00
co-authored by Claude Opus 5.5
parent bd3c48c525
commit 37634e2c26
12 changed files with 680 additions and 75 deletions
@@ -1,4 +1,4 @@
"""M02 구조물 옵션 보이기 길 — 정본 `M02_SO_Options.py`.
"""M02 구조물 옵션 보이기 · 그룹 길 — 정본 `M02_SO_Options.py` · `M02_SO_Groups.py`.
`router` = 고쳐 씀 · 관리 읽기(`main.py` 가 `system_admin_only` 로 붙임) ·
`read_router` = 읽기만(로그인 누구나 · `main.py` 가 `protected` 로 붙임).
@@ -14,6 +14,7 @@ from pydantic import BaseModel
from common_util.common_util_auth import verify_session
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_Groups as groups
from M02_MasterTemplete.StructOptions import M02_SO_Options as options
router = APIRouter(prefix="/api/m02", tags=["M02 MasterTemplete"])
@@ -25,6 +26,11 @@ class OptionsBody(BaseModel):
표시: dict[str, Any] # {종류: {옵션 키: 참 · 거짓}} — 거짓만 남김
class GroupsBody(BaseModel):
판: str = "" # 그룹 표 판 — 어긋나면 409
그룹: dict[str, Any] # {종류: [{id, 이름, 옵션[]}]}
def _call(fn, *args):
with store.at(store.FOLDER):
try:
@@ -45,6 +51,18 @@ def put_structure_options(body: OptionsBody) -> dict:
return _call(options.save, body.표시, body.판)
@router.get("/structure-option-groups")
def get_structure_option_groups() -> dict:
"""`{판, 그룹, 종류}` — 그룹 = `{type_id: [{id, 이름, 옵션}]}` · 종류 = 레지스트리 전부."""
return _call(groups.listing)
@router.put("/structure-option-groups")
def put_structure_option_groups(body: GroupsBody) -> dict:
"""고쳐 씀(낡은 판 409 · 없는 종류 · 키 · 겹침 422) — 돌려주는 것 = 새 `{판, 그룹, 종류}`."""
return _call(groups.save, body.그룹, body.판)
@read_router.get("/layers/system/structure-options")
def get_structure_options_read(session=Depends(verify_session)) -> dict:
"""구조물 옵션 보이기 읽기 — 로그인 누구나(마스터 한 벌 · 고쳐 씀은 시스템 관리자만)."""