feat(project): 보드 카드를 같은 세션 안에서 드래그로 순서 변경

지금까지 같은 세션에 다시 놓으면 아무 일도 안 일어났다(다른 세션으로
옮길 때만 동작). 놓은 위치(마우스 Y좌표)를 카드들 사이 인덱스로 계산해
그 순서를 새 엔드포인트로 저장하고(tasks.sort_order, 세션 소속만 재배정 —
세션 재정렬의 reorder_stages 와 동일 패턴), 로컬 tasks 배열도 그 순서에
맞게 재배치(applyStageOrder)해 새로고침 없이 즉시 반영. 실제 3개 업무로
드래그→서버 저장→하드리로드까지 헤드리스 크롬으로 검증.
This commit is contained in:
2026-09-16 15:31:26 +09:00
parent 4dbb3e7856
commit cfa41f0f6f
7 changed files with 80 additions and 7 deletions
+15
View File
@@ -1287,6 +1287,21 @@ async def api_reorder_stages(
return JSONResponse({"stages": st.list_stages(project_id=project_id)})
@router.put("/api/projects/{project_id}/stages/{stage_id}/tasks/order")
async def api_reorder_tasks(
request: Request, project_id: int, stage_id: int, payload: dict[str, Any] = Body(...)
) -> JSONResponse:
"""보드에서 카드를 같은 세션 안에서 드래그로 재정렬."""
user = _require_user(request)
st = _db_or_503(request)
_require_manage(request, st, user, project_id)
ids = payload.get("ordered_ids") or []
if not isinstance(ids, list) or not ids:
raise HTTPException(status_code=400, detail="ordered_ids 가 필요합니다.")
st.reorder_tasks(stage_id=stage_id, ordered_ids=[int(i) for i in ids])
return JSONResponse({"ok": True})
@router.put("/api/projects/{project_id}/stages/{stage_id}")
async def api_update_stage(
request: Request, project_id: int, stage_id: int, payload: dict[str, Any] = Body(...)