feat(M01): POST /api/m01/logic/flow — 저장 안 한 고친 줄(옛 편집기)을 흐름으로 변환해 돌려줌(쓰기 없음)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KmELpdXFDRZHhfbGuRhSmL
This commit is contained in:
@@ -250,6 +250,18 @@ def get_logic_flow(key: str, file: str = "") -> dict:
|
||||
return _call(flow.get_flow, file, key)
|
||||
|
||||
|
||||
class FlowDraft(BaseModel):
|
||||
file: str = ""
|
||||
key: str = ""
|
||||
row: dict[str, Any]
|
||||
|
||||
|
||||
@router.post("/logic/flow")
|
||||
def post_logic_flow(body: FlowDraft) -> dict:
|
||||
"""저장 안 한 고친 줄(옛 편집기) → 흐름 변환 — {flow, converted, notes} · 쓰기 없음."""
|
||||
return _call(flow.get_flow, body.file, body.key, body.row)
|
||||
|
||||
|
||||
@router.post("/logic/new")
|
||||
def post_logic_new(body: NewLogic) -> dict:
|
||||
return _call(make.logic_new, body.logic, body.owner)
|
||||
|
||||
@@ -262,10 +262,13 @@ def _row(file: str, key: str) -> dict:
|
||||
return hit
|
||||
|
||||
|
||||
def get_flow(file: str, key: str) -> dict:
|
||||
"""{flow, converted, notes} — 흐름이 있으면 그대로 · 없으면 변환(파일은 안 바뀜)."""
|
||||
row = _row(file, key)
|
||||
if isinstance(row.get(FLOW), dict):
|
||||
def get_flow(file: str, key: str, draft: dict | None = None) -> dict:
|
||||
"""{flow, converted, notes} — 흐름이 있으면 그대로 · 없으면 변환(파일은 안 바뀜)
|
||||
· draft = 저장 안 한 고친 줄(옛 편집기) — 늘 그 줄 그대로 변환(쓰기 없음)."""
|
||||
row = _row(file, key) if draft is None else store._dec({**draft, "키": draft.get("키") or key})
|
||||
if draft is not None:
|
||||
row.pop(FLOW, None)
|
||||
elif isinstance(row.get(FLOW), dict):
|
||||
return {"flow": {**row[FLOW], "key": key}, "converted": False, "notes": []}
|
||||
try:
|
||||
convert = importlib.import_module(CONVERT).convert
|
||||
|
||||
Reference in New Issue
Block a user