fix(project): meeting task table shared per week on the server (others' rows were invisible)

- Cause: the table lived only in each browser's localStorage
- project_db migration 025 goal_meeting_tasks (week_start, parent_id for subtask rows, task_id)
- API list/add/update/delete + apply; apply locks the row and creates the task once via the
  same helper as the task window (_create_task_for: membership, assignee check, notifications)
- Non-members see other people's rows with project/section/task hidden; only member projects
  can be picked; completed meeting is read-only (409)
- Client saves per field, refreshes every 30s / on focus, uploads rows left in this browser once
- Docs (DEPLOYMENT 025, PROJECT_MODULE, help, CLAUDE.md); tests (real PostgreSQL incl. 4
  concurrent applies -> one task, jsdom)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 16:06:23 +09:00
parent 4320766abd
commit b7c0f28ad2
20 changed files with 704 additions and 130 deletions
+54
View File
@@ -1196,6 +1196,60 @@ def test_review_meeting_section_move():
_drop_meetings([w1, w2])
def test_review_meeting_quick_tasks_shared():
"""작업 등록 표(025) — 주차별 한 표를 모두가 같이 본다. 남의 프로젝트 이름은 가리고, [적용]은 동시에 눌러도 작업 하나."""
from app.modules.project import store
w = store.month_weeks(2031, 12)[1][0]
other = store.month_weeks(2031, 12)[2][0]
p = _project("P-quick", ADMIN, (BOB,))
s = _stage(p["id"], by=ADMIN)
done = _stage(p["id"], name="완료", done=True, by=ADMIN)
url = f"/project/api/goals/meetings/{w}/quick-tasks"
r = req("POST", url, BOB, json={"title": "상세페이지 수정", "project_id": p["id"], "stage_id": s["id"], "assignee_email": BOB})
assert r.status_code == 201, r.text
row = r.json()["task"]
# 다른 사람(ALICE — 이 프로젝트 멤버 아님)도 같은 표를 본다 — 프로젝트 이름은 가림
seen = req("GET", url, ALICE).json()["tasks"]
assert [x["id"] for x in seen] == [row["id"]] and seen[0]["title"] == "상세페이지 수정"
assert seen[0]["visible"] is False and seen[0]["project_name"] == "(볼 수 없는 프로젝트)"
assert req("GET", f"/project/api/goals/meetings/{other}/quick-tasks", BOB).json()["tasks"] == [] # 주차마다 따로
# 남의 프로젝트는 고를 수 없다
assert req("POST", url, ALICE, json={"title": "x", "project_id": p["id"]}).status_code == 403
# 고치기 — 다른 프로젝트 섹션은 거절, 제목은 저장
assert req("PUT", f"/project/api/goals/meeting-quick-tasks/{row['id']}", BOB, json={"stage_id": 10 ** 9}).status_code == 400
assert req("PUT", f"/project/api/goals/meeting-quick-tasks/{row['id']}", BOB, json={"title": "상세페이지 수정2"}).status_code == 200
# [적용] — 비멤버는 403, 멤버가 동시에 4번 눌러도 작업 하나
assert req("POST", f"/project/api/goals/meeting-quick-tasks/{row['id']}/apply", ALICE).status_code == 403
outs = _race([lambda: req("POST", f"/project/api/goals/meeting-quick-tasks/{row['id']}/apply", BOB) for _ in range(4)])
assert sorted(o.status_code for o in outs) == [200, 200, 200, 201], [o.status_code for o in outs]
tid = next(o.json()["task"]["task_id"] for o in outs if o.status_code == 201)
assert _count("SELECT COUNT(*) AS n FROM tasks WHERE project_id = %s AND title = %s", p["id"], "상세페이지 수정2") == 1
t = ST.get_task(task_id=tid)
assert t["stage_id"] == s["id"] and t["assignee_email"] == BOB
# 등록된 줄은 더 못 고침(409), 다시 [적용]해도 그대로
assert req("PUT", f"/project/api/goals/meeting-quick-tasks/{row['id']}", BOB, json={"title": "x"}).status_code == 409
# 세부 작업 줄 — 위 줄의 작업 밑에 만든다(섹션 없음)
r = req("POST", url, BOB, json={"title": "세부 하나", "project_id": p["id"], "parent_id": row["id"]})
sub = r.json()["task"]
r = req("POST", f"/project/api/goals/meeting-quick-tasks/{sub['id']}/apply", BOB)
assert r.status_code == 201, r.text
st_ = ST.get_task(task_id=r.json()["task"]["task_id"])
assert st_["parent_task_id"] == tid and st_["stage_id"] is None
# 회의 완료면 잠금
_drop_meetings([w])
try:
_create_meeting(w)
ST.set_meeting_completed(week_start=w, done=True, by=ADMIN)
assert req("POST", url, BOB, json={"title": "늦게"}).status_code == 409
assert req("DELETE", f"/project/api/goals/meeting-quick-tasks/{sub['id']}", BOB).status_code == 409
finally:
_drop_meetings([w])
assert req("DELETE", f"/project/api/goals/meeting-quick-tasks/{row['id']}", BOB).status_code == 200
assert req("GET", url, BOB).json()["tasks"] == [] # 세부 작업 줄도 함께
_ = done
if __name__ == "__main__":
if not ENABLED:
print("SKIP: PROJECT_TEST_DB_URL(localhost) not set")