feat(M01): 복사해서 만들기 엔진·서버 — 정본 로직을 별칭 꼴 식으로 펴고 되돌려 자체 로직으로 저장
- `scripts/master_copy.py` — `찾기()`·`로직()` 한 덩이를 별칭 이름으로 · 원문은 별칭표에 그대로 (자르기는 `master_formula` 파서 그대로 · 완전 같은 부르기는 합침 · 인자가 갈리면 등장 차례로 번호) - `GET /logic/formula` · `POST /logic/formula/save` — 저장은 별칭을 원문으로 되돌린 뒤 `logic/new` 재사용 - 계약 `_화면_계약.md` 7장 · 시험 `test_m01_copy.py` 8 통과(로직 1,354줄 되돌리기 전수 포함)
This commit is contained in:
@@ -63,6 +63,16 @@ class DeleteLogic(BaseModel):
|
||||
version: str
|
||||
|
||||
|
||||
class FormulaLogic(BaseModel):
|
||||
"""복사해서 만들기 — 별칭 꼴 식이 든 로직 줄과 그 별칭표(되돌릴 원문)."""
|
||||
|
||||
로직: dict[str, Any]
|
||||
별칭: list[dict[str, Any]] = []
|
||||
owner: str = make.OWNERS[0]
|
||||
이름: str = ""
|
||||
본뜬키: str = ""
|
||||
|
||||
|
||||
def _num(v):
|
||||
"""Decimal → JSON 수(그냥 두면 글자로 나감)."""
|
||||
if isinstance(v, Decimal):
|
||||
@@ -214,3 +224,15 @@ def post_logic_edit(body: EditLogic) -> dict:
|
||||
@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:
|
||||
"""복사해서 만들기 — 로직 한 줄을 별칭 꼴 식 묶음으로."""
|
||||
return _call(make.logic_formula, key)
|
||||
|
||||
|
||||
@router.post("/logic/formula/save")
|
||||
def post_logic_formula_save(body: FormulaLogic) -> dict:
|
||||
"""고친 식 묶음을 자체 로직(`GX`)으로 — 별칭은 원문으로 되돌려 저장."""
|
||||
return _call(make.logic_from_formula, body.로직, body.별칭, body.owner, body.이름, body.본뜬키)
|
||||
|
||||
Reference in New Issue
Block a user