feat(project): 업무를 옮기면 설명 링크 속 드라이브 파일도 새 폴더로
업무의 섹션·프로젝트가 바뀌거나 세부 업무를 다른 상위 업무로 옮기면 드라이브 폴더 경로(프로젝트/섹션/업무/세부 업무)가 달라지는데 파일은 예전 폴더에 남았다. 이동 API(업무 수정·move-parent·move-project) 뒤 백그라운드로 업무와 모든 하위 업무의 설명 링크 파일을 새 폴더로 옮긴다. 그 업무가 올린 파일(appProperties dbxTaskId)만 옮기고, 예전 폴더는 둔다. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -661,6 +661,19 @@ class ProjectStore:
|
||||
).fetchone()
|
||||
return self._serialize(row) if row else None
|
||||
|
||||
def task_subtree_ids(self, *, task_id: int) -> list[int]:
|
||||
"""업무 id + 모든 하위(세부 업무의 세부 업무까지) id — 위에서 아래 순. 업무를 옮길 때 드라이브 파일도 함께."""
|
||||
with self._pool.connection() as conn:
|
||||
rows = conn.execute(
|
||||
"WITH RECURSIVE sub(id, depth) AS ("
|
||||
" SELECT id, 0 FROM tasks WHERE id = %s"
|
||||
" UNION ALL SELECT t.id, sub.depth + 1 FROM tasks t JOIN sub ON t.parent_task_id = sub.id"
|
||||
" WHERE sub.depth < 20"
|
||||
") SELECT id FROM sub ORDER BY depth, id",
|
||||
(int(task_id),),
|
||||
).fetchall()
|
||||
return [int(r["id"]) for r in rows]
|
||||
|
||||
def description_mentions(self, *, text: str, exclude_task_id: int) -> bool:
|
||||
"""다른 업무 설명에 text(드라이브 파일 id 등)가 들어 있나 — 링크를 지운 파일을 휴지통에 넣기 전 확인."""
|
||||
like = "%" + text.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_") + "%"
|
||||
|
||||
Reference in New Issue
Block a user