Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BW6Jdsh18WPtYUR6THZJqn
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
"""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
|