feat(z01): 마스터 데이터 읽기 API 첫 벌 — 갈래 넷(로직 17·기초값 9·부산물 4·씨앗 1) → 파일 → 표 트리 · 표 줄 쪽 나누기·검색 · 이름표 파일 label·unit · 내부 id·sha·생성시각 숨김 · 강우 IDF 캐시 뺌(브레인 새 판 · 표 id 는 이름표 파일에 맞추기 전)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BW6Jdsh18WPtYUR6THZJqn
This commit is contained in:
2026-09-15 19:03:27 +09:00
co-authored by Claude Opus 5
parent 1395ae6d34
commit 827054f8b1
3 changed files with 482 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
"""Z01 마스터 데이터 라우터 — 읽기 전용(고치기는 다음 차례 · 2026-09-15 브레인).
GET /api/master-data/tree 갈래 → 파일 → 표
GET /api/master-data/rows?file=&table=&page=&size=&q= 표 줄(쪽 나누기 · 검색)
⚠ 권한은 등록하는 쪽(`main.py` · 랩탑 서브)이 `dependencies=[verify_session, require_system_admin]` 로 붙임.
"""
from __future__ import annotations
from fastapi import APIRouter, HTTPException
from Z01_MasterData import Z01_MasterData_Tables as tables
router = APIRouter(prefix="/api/master-data", tags=["Z01 MasterData"])
@router.get("/tree")
def get_tree() -> dict:
return tables.tree()
@router.get("/rows")
def get_rows(
file: str, table: str, page: int = 1, size: int = tables.DEFAULT_PAGE_SIZE, q: str = ""
) -> dict:
result = tables.rows(file, table, page=page, size=size, q=q)
if result is None:
raise HTTPException(status_code=404, detail="없는 파일이나 표입니다.")
return result