feat(project): add cell moves and width menus
This commit is contained in:
@@ -2598,6 +2598,8 @@ def _goal_call(fn: Any, *args: Any, **kwargs: Any) -> Any:
|
||||
raise HTTPException(status_code=503, detail=_GOALS_016_MSG)
|
||||
except store.GoalMigration017Needed:
|
||||
raise HTTPException(status_code=503, detail=_GOALS_017_MSG)
|
||||
except store.GoalCellConflict as exc:
|
||||
raise HTTPException(status_code=409, detail=str(exc))
|
||||
except UndefinedTable:
|
||||
raise HTTPException(status_code=503, detail=_GOALS_MIGRATION_MSG)
|
||||
except KeyError:
|
||||
@@ -2807,6 +2809,22 @@ def api_set_goal_cell(
|
||||
return JSONResponse({"ok": True})
|
||||
|
||||
|
||||
@router.post("/api/goals/cells/move")
|
||||
def api_move_goal_cell(request: Request, payload: dict[str, Any] = Body(...)) -> JSONResponse:
|
||||
"""내용·글자 서식만 원자적으로 이동. 원본·대상의 예상값이 바뀌면 409, 병합 배치는 유지."""
|
||||
user = _require_admin(request)
|
||||
st = _db_or_503(request)
|
||||
if any(not isinstance(payload.get(k), str) for k in ("source_body", "target_body", "body")):
|
||||
raise HTTPException(status_code=400, detail="이동할 내용과 두 칸의 현재 내용을 보내 주세요.")
|
||||
body = _goal_call(
|
||||
st.move_goal_cell, source_row=payload.get("source_row"), source_month=payload.get("source_month"),
|
||||
target_row=payload.get("target_row"), target_month=payload.get("target_month"),
|
||||
source_body=payload["source_body"], target_body=payload["target_body"], body=payload["body"],
|
||||
updated_by=user["email"],
|
||||
)
|
||||
return JSONResponse({"ok": True, "body": body})
|
||||
|
||||
|
||||
@router.post("/api/goals/areas/{area_id}/merge")
|
||||
def api_merge_goal_rect(request: Request, area_id: int, payload: dict[str, Any] = Body(...)) -> JSONResponse:
|
||||
"""엑셀식 병합 {row_from, row_to(줄 id), col_from, col_to(칸 번호 0·1~12·13~16)} — 같은 영역 안 사각형,
|
||||
|
||||
Reference in New Issue
Block a user