refactor(853-1): M01 화면 0 서버 길 15 와 본체 걷음 — 묶음 ② 고친 파일(앞 커밋 654b75b5c 는 지운 파일만 담김)
- 길 지움(화면 TS · 다른 서버 모듈 · 시험 세 곳에서 다시 찾음 · /openapi.json 524 → 509 뜻한 15 만): GET /groups · /sections · /table/options · /logic/combos · POST /logic/new · /logic/edit · /logic/delete · /logic/draft · /logic/sheet · /logic/sheet/check · /logic/equation(+ preview · links · save) · /logic/doc/links - 본체 지움: M01_MasterData_Sheet.py · Equation.read · preview · save · Store_Make.sections · _counts · table_options · logic_edit · logic_delete · _own_only · logic_draft · Store.groups · Store_Combo.combo_preview · scripts/master_draft.py(지운 /logic/draft 만 부름) - 남김: Equation.export_row · edit_row · links(M02 Sangeun_Equation 이 부름) · Doc.candidates(M02 /doc/links) · Store_Make._all_sections(M02 Hopyo_Clause) · logic_new(복사 · 수식 저장이 씀) · combos_of_logic(Doc.users) · combo_inputs(알약 규칙 입구 · 시험) · master_combo.run(M02 시험 대조 값) · /alias/suggest(main.py 가 따로 끼움 · 승인 화면과 한 벌) - 화면 입구 지움: Api_Fetch.fetchGroups · GroupInfo · fetchSubs · Logic_Api.draftLogic + Draft 타입 6 - 시험: test_m01_draft 지움(죽은 해석기 · 길만 봄) · test_794_1 시트 길 시험 지우고 /save 다시 셈 시험만 남김 · test_796_1 수식 길 시험 지움 · test_800_2 는 살아 있는 export_row · edit_row 로 같은 셈 · test_m01_make 는 죽은 길 대신 /save · logic_new 로 같은 결과 · test_m01_combo 미리 보기 시험 지움 · /logic/combos 는 combos_of_logic 로 · test_m01_api · test_802_3 · test_799_2 · test_717_1(+helper) 죽은 길 줄만 고침 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,14 +13,11 @@ from fastapi import APIRouter, HTTPException
|
||||
from pydantic import BaseModel
|
||||
|
||||
from M01_MasterData import M01_MasterData_Doc as doc_screen
|
||||
from M01_MasterData import M01_MasterData_Equation as equation
|
||||
from M01_MasterData import M01_MasterData_Machine as machine
|
||||
from M01_MasterData import M01_MasterData_Machine_Impact as machine_impact
|
||||
from M01_MasterData import M01_MasterData_Machine_Uses as machine_uses
|
||||
from M01_MasterData import M01_MasterData_Parts as parts
|
||||
from M01_MasterData import M01_MasterData_Sheet as line_sheet
|
||||
from M01_MasterData import M01_MasterData_Store as store
|
||||
from M01_MasterData import M01_MasterData_Store_Combo as combo_store
|
||||
from M01_MasterData import M01_MasterData_Store_List as store_list
|
||||
from M01_MasterData import M01_MasterData_RateSheet as rate_sheet
|
||||
from M01_MasterData import M01_MasterData_Store_Make as make
|
||||
@@ -62,29 +59,12 @@ class SaveBody(BaseModel):
|
||||
개정확인: bool = False # 로직 정본 줄 고침 = 「원문 개정 반영」 확인(713-1) · 없으면 409
|
||||
|
||||
|
||||
class NewLogic(BaseModel):
|
||||
logic: dict[str, Any]
|
||||
owner: str = make.OWNERS[0]
|
||||
|
||||
|
||||
class CopyLogic(BaseModel):
|
||||
key: str
|
||||
이름: str = ""
|
||||
owner: str = make.OWNERS[0]
|
||||
|
||||
|
||||
class EditLogic(BaseModel):
|
||||
key: str
|
||||
version: str
|
||||
logic: dict[str, Any]
|
||||
owner: str = ""
|
||||
|
||||
|
||||
class DeleteLogic(BaseModel):
|
||||
key: str
|
||||
version: str
|
||||
|
||||
|
||||
class FormulaLogic(BaseModel):
|
||||
"""복사해서 만들기 — 별칭 꼴 식이 든 로직 줄과 그 별칭표(되돌릴 원문)."""
|
||||
|
||||
@@ -102,14 +82,6 @@ class FormulaPreview(BaseModel):
|
||||
별칭: list[dict[str, Any]] = []
|
||||
|
||||
|
||||
class DraftLogic(BaseModel):
|
||||
text: str # 줄로 적은 식 — 줄마다 「이름 = 식」
|
||||
decided: dict[str, Any] = {} # 변수마다 정한 것 {이름: {무엇, 단위, 비목, 요소·찾기·값}}
|
||||
head: dict[str, Any] | None = None # 로직 머리(이름 · 결과단위 …) — 주면 로직 줄까지
|
||||
save: bool = False
|
||||
owner: str = make.OWNERS[0]
|
||||
|
||||
|
||||
def _num(v):
|
||||
"""Decimal → JSON 수(그냥 두면 글자로 나감)."""
|
||||
if isinstance(v, Decimal):
|
||||
@@ -128,11 +100,6 @@ def _call(fn, *args):
|
||||
raise HTTPException(status_code=e.status, detail=e.detail) from e
|
||||
|
||||
|
||||
@router.get("/groups")
|
||||
def get_groups() -> dict:
|
||||
return {"groups": _call(store.groups)}
|
||||
|
||||
|
||||
@router.get("/groups/{group}/files")
|
||||
def get_files(group: str) -> dict:
|
||||
"""`판정규` = 머리 판의 해(「2026-01-01」 · 「2026」 → 「2026」) · 읽을 때 파생(파일 안 씀)."""
|
||||
@@ -190,20 +157,6 @@ def get_table(file: str, key: str) -> dict:
|
||||
return {**out, "기준파생": _num(mbs.basis(out["table"]))}
|
||||
|
||||
|
||||
@router.get("/table/options")
|
||||
def get_table_options(file: str, key: str) -> dict:
|
||||
"""표 조건 칸의 값만 — 줄을 통째로 받지 않음."""
|
||||
return _call(make.table_options, file, key)
|
||||
|
||||
|
||||
@router.get("/sections")
|
||||
def get_sections(
|
||||
book: str, division: str = "", chapter: str = "", q: str = "", limit: int = 200
|
||||
) -> dict:
|
||||
"""원문 절 목록 — 만들기 첫 걸음."""
|
||||
return _call(make.sections, book, division, chapter, q, limit)
|
||||
|
||||
|
||||
@router.get("/logics")
|
||||
def get_logics(
|
||||
sub: str = "", detail: str = "", q: str = "", blocked: int | None = None, owner: str = ""
|
||||
@@ -338,26 +291,11 @@ def post_save(body: SaveBody) -> dict:
|
||||
return _call(make.save, [f.model_dump() for f in body.files], body.개정확인)
|
||||
|
||||
|
||||
@router.post("/logic/new")
|
||||
def post_logic_new(body: NewLogic) -> dict:
|
||||
return _call(make.logic_new, body.logic, body.owner)
|
||||
|
||||
|
||||
@router.post("/logic/copy")
|
||||
def post_logic_copy(body: CopyLogic) -> dict:
|
||||
return _call(make.logic_copy, body.key, body.이름, body.owner)
|
||||
|
||||
|
||||
@router.post("/logic/edit")
|
||||
def post_logic_edit(body: EditLogic) -> dict:
|
||||
return _call(make.logic_edit, body.key, body.version, body.logic, body.owner)
|
||||
|
||||
|
||||
@router.post("/logic/delete")
|
||||
def post_logic_delete(body: DeleteLogic) -> dict:
|
||||
return _call(make.logic_delete, body.key, body.version)
|
||||
|
||||
|
||||
@router.get("/logic/formula")
|
||||
def get_logic_formula(key: str) -> dict:
|
||||
"""복사해서 만들기 — 로직 한 줄을 별칭 꼴 식 묶음으로."""
|
||||
@@ -376,73 +314,6 @@ def post_logic_formula_preview(body: FormulaPreview) -> dict:
|
||||
return _call(make.logic_formula_preview, body.로직, body.별칭)
|
||||
|
||||
|
||||
@router.post("/logic/draft")
|
||||
def post_logic_draft(body: DraftLogic) -> dict:
|
||||
"""식으로 새 로직 만들기 — 변수 뽑기 · 검사 · 로직 줄로 옮기기(`save` 면 저장까지)."""
|
||||
return _call(make.logic_draft, body.text, body.decided, body.head, body.save, body.owner)
|
||||
|
||||
|
||||
class SheetRow(BaseModel):
|
||||
row: dict[str, Any]
|
||||
|
||||
|
||||
class SheetCheck(BaseModel):
|
||||
row: dict[str, Any]
|
||||
갈래: Literal["중간", "호표", "덧줄"]
|
||||
차례: int
|
||||
식: str
|
||||
|
||||
|
||||
@router.post("/logic/sheet")
|
||||
def post_logic_sheet(body: SheetRow) -> dict:
|
||||
"""줄 식 시트(794-1) — 줄마다 이름 꼴 식 글 · 식 칸 이름표(셈 · 쓰기 없음)."""
|
||||
return _call(line_sheet.names, body.row)
|
||||
|
||||
|
||||
@router.post("/logic/sheet/check")
|
||||
def post_logic_sheet_check(body: SheetCheck) -> dict:
|
||||
"""시트 식 칸 칠 때마다 — {되나, 까닭, 식(엔진), 글(이름 꼴)} · 저장 때와 같은 엔진 검사."""
|
||||
return _call(line_sheet.check, body.row, body.갈래, body.차례, body.식)
|
||||
|
||||
|
||||
class EquationBody(BaseModel):
|
||||
key: str
|
||||
inputs: dict[str, Any] = {}
|
||||
고침: list[dict[str, Any]] = []
|
||||
version: str = ""
|
||||
개정확인: bool = False
|
||||
|
||||
|
||||
@router.post("/logic/equation")
|
||||
def post_logic_equation(body: EquationBody) -> dict:
|
||||
"""수식 탭(796-1) — 줄마다 이름식 · 값식 나무 · 풀이 · 변수표 · 합계(셈 · 쓰기 없음)."""
|
||||
return _call(equation.read, body.key, body.inputs)
|
||||
|
||||
|
||||
@router.post("/logic/equation/preview")
|
||||
def post_logic_equation_preview(body: EquationBody) -> dict:
|
||||
"""수식 고침 미리 셈 — {되나, 까닭, 줄, 수식, 전, 후} · 저장 안 함."""
|
||||
return _call(equation.preview, body.key, body.고침, body.inputs)
|
||||
|
||||
|
||||
class LinksBody(BaseModel):
|
||||
갈래: str
|
||||
검색: str = ""
|
||||
분류: str = "인력"
|
||||
|
||||
|
||||
@router.post("/logic/equation/links")
|
||||
def post_logic_equation_links(body: LinksBody) -> dict:
|
||||
"""새 기호 연결 후보(800-3) — 표 · 요소 · 로직 이름 찾기(읽기만)."""
|
||||
return _call(equation.links, body.model_dump())
|
||||
|
||||
|
||||
@router.post("/logic/equation/save")
|
||||
def post_logic_equation_save(body: EquationBody) -> dict:
|
||||
"""수식 고침 저장 — 검사 통과 뒤 `/save` 길(정본 = 개정확인 · 판 다르면 409)."""
|
||||
return _call(equation.save, body.key, body.고침, body.inputs, body.version, body.개정확인)
|
||||
|
||||
|
||||
# ── 수식 문서(802-3) — 단가산출 기초 정본 · 화면은 같은 계산기로 즉시 셈 ──
|
||||
class DocBody(BaseModel):
|
||||
문서: dict[str, Any]
|
||||
@@ -486,20 +357,7 @@ def post_logic_remove(body: RemoveBody) -> dict:
|
||||
return _call(doc_screen.remove, body.key, body.file, body.version, body.개정확인)
|
||||
|
||||
|
||||
@router.post("/logic/doc/links")
|
||||
def post_logic_doc_links(body: LinksBody) -> dict:
|
||||
"""연결 후보 — 요소 · 표 · 단가산출(수식 문서) 이름 찾기(읽기만)."""
|
||||
return _call(doc_screen.candidates, body.model_dump())
|
||||
|
||||
|
||||
@router.get("/logic/doc/table")
|
||||
def get_logic_doc_table(key: str) -> dict:
|
||||
"""표 하나 — 조건 · 칸 고르기(읽기만)."""
|
||||
return _call(doc_screen.table, key)
|
||||
|
||||
|
||||
# ── 일위대가 조합 — 조합 길은 M02 층 길(`/api/m02/layers/{layer}/combos` · PLAN 27-2a) ──
|
||||
@router.get("/logic/combos")
|
||||
def get_logic_combos(key: str) -> dict:
|
||||
"""이 단가산출 로직을 담은 조합 — 로직 쪽에서 거꾸로 봄."""
|
||||
return _call(combo_store.combos_of_logic, key)
|
||||
|
||||
Reference in New Issue
Block a user