feat(project): add meeting cell editing

Apply project_db migration 019 to enable vertical cell merges. Other cell editing remains available before migration.
This commit is contained in:
2026-10-03 15:11:41 +09:00
parent 193da56edf
commit 090e508bf3
18 changed files with 1054 additions and 78 deletions
+37
View File
@@ -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.MeetingCellMigrationNeeded:
raise HTTPException(status_code=503, detail="회의록 셀 병합은 project_db 마이그레이션 019 적용 후 사용할 수 있습니다.")
except store.GoalCellConflict as exc:
raise HTTPException(status_code=409, detail=str(exc))
except UndefinedTable:
@@ -3055,6 +3057,15 @@ def _meeting_view(request: Request, st: Any, *, year: int, month: int, week: dat
sections.append({"name": it["section"], "color": it["section_color"], "rows": []})
sections[-1]["rows"].append(it) # 키 이름 rows — 템플릿의 sec.items 는 dict.items 메서드가 된다
meeting["sections"] = sections
for sec in sections:
covered = 0
for i, it in enumerate(sec["rows"]):
it["content_html"] = store.goal_text_html(it["content"])
it["content_hidden"] = covered > 0
it["content_span"] = min(int(it.get("content_row_span") or 1), len(sec["rows"]) - i)
covered = covered - 1 if covered else it["content_span"] - 1
if it.get("prev"):
it["prev"]["content_html"] = store.goal_text_html(it["prev"]["content"])
prev_items = [it["prev"] for it in meeting["items"] if it.get("prev")]
head["prev_items_target"] = sum(p["target_amount"] or 0 for p in prev_items) if prev_items else None
return {"meeting": meeting, "head": head,
@@ -3296,6 +3307,32 @@ def api_delete_meeting_item(request: Request, item_id: int) -> JSONResponse:
return JSONResponse({"ok": True})
@router.post("/api/goals/meeting-cells/move")
def api_move_meeting_cell(request: Request, payload: dict[str, Any] = Body(...)) -> JSONResponse:
user = _require_admin(request)
st = _db_or_503(request)
if not all(k in payload for k in ("source_item", "target_item", "source_body", "target_body")):
raise HTTPException(status_code=400, detail="원본·대상 셀과 예상 내용을 함께 보내 주세요.")
body = _goal_call(st.move_meeting_cell, source_item=payload["source_item"], target_item=payload["target_item"],
source_body=payload["source_body"], target_body=payload["target_body"], updated_by=user["email"])
return JSONResponse({"ok": True, "body": body})
@router.post("/api/goals/meeting-cells/merge")
def api_merge_meeting_cells(request: Request, payload: dict[str, Any] = Body(...)) -> JSONResponse:
user = _require_admin(request)
result = _goal_call(_db_or_503(request).merge_meeting_cells, item_from=payload.get("item_from"),
item_to=payload.get("item_to"), updated_by=user["email"])
return JSONResponse({"ok": True, **result})
@router.delete("/api/goals/meeting-items/{item_id}/cell-merge")
def api_unmerge_meeting_cell(request: Request, item_id: int) -> JSONResponse:
user = _require_admin(request)
_goal_call(_db_or_503(request).unmerge_meeting_cell, item_id=item_id, updated_by=user["email"])
return JSONResponse({"ok": True})
@router.post("/api/goals/meeting-items/{item_id}/move")
def api_move_meeting_item(request: Request, item_id: int, payload: dict[str, Any] = Body(...)) -> JSONResponse:
_require_admin(request)