feat(M02): 담을 로직 읽기 길 /api/m02/logic-lib — 로그인이면 로직 목록 · 갈래 · 하나 · 견본 입력(PLAN 27-2b 서버)
- 회사 · 개인 조합 편집이 M01 관리자 전용 길 없이 로직을 고르고 미리 보기 - 시험 test_m02_combo_layers 한 벌 더함(9) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BU9gbNE3aWFUvE61pS2WGt
This commit is contained in:
@@ -5,16 +5,19 @@
|
||||
company 읽기 = 같은 회사 · 쓰기 = 회사 관리자(키 UC{회사}-######)
|
||||
personal 읽기 · 쓰기 = 본인(키 UP{사용자}-######)
|
||||
저장소 = `M02_MasterTemplete_Combo_Store`.
|
||||
담을 로직 고르기 · 미리 보기가 읽는 단가산출 로직(M01 길은 시스템 관리자 전용)은
|
||||
`/api/m02/logic-lib/…` 읽기만(로그인) — 모양은 M01 길과 같음.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from pydantic import BaseModel
|
||||
|
||||
from common_util.common_util_auth import verify_session
|
||||
from M01_MasterData import M01_MasterData_Store as m01
|
||||
from M02_MasterTemplete import M02_MasterTemplete_Combo_Store as combos
|
||||
from M02_MasterTemplete.M02_MasterTemplete_Router_Items import (
|
||||
Layer,
|
||||
@@ -138,3 +141,32 @@ def post_preview(
|
||||
):
|
||||
"""보기만 — 수량(inputs)은 이 부름에만 실림 · 저장 안 함 · 읽기 권한."""
|
||||
return _call(_root(session, layer, owner), combos.preview, body.combo, body.inputs)
|
||||
|
||||
|
||||
# ── 담을 로직(읽기만) — M01 `/logics` · `/subs?group=로직` · `/logic` · `/logic/auto` 모양 ──
|
||||
def _read(fn, *args):
|
||||
try:
|
||||
return fn(*args)
|
||||
except m01.StoreError as e:
|
||||
raise HTTPException(status_code=e.status, detail=e.detail) from e
|
||||
|
||||
|
||||
@router.get("/logic-lib/logics", dependencies=[Depends(verify_session)])
|
||||
def get_logics() -> dict:
|
||||
return {"logics": _read(m01.logics, "", "", "", None)}
|
||||
|
||||
|
||||
@router.get("/logic-lib/subs", dependencies=[Depends(verify_session)])
|
||||
def get_logic_subs() -> dict:
|
||||
return _read(m01.subs, "", "로직")
|
||||
|
||||
|
||||
@router.get("/logic-lib/logic", dependencies=[Depends(verify_session)])
|
||||
def get_logic(key: str) -> dict:
|
||||
return _read(m01.logic, key)
|
||||
|
||||
|
||||
@router.get("/logic-lib/auto", dependencies=[Depends(verify_session)])
|
||||
def get_logic_auto(key: str) -> dict:
|
||||
"""견본 입력 — 미리 보기용 자동값."""
|
||||
return _read(m01.auto, key)
|
||||
|
||||
Reference in New Issue
Block a user