diff --git a/app/modules/cupang/templates/cupang/index.html b/app/modules/cupang/templates/cupang/index.html index 62a0c2e..98f2c82 100644 --- a/app/modules/cupang/templates/cupang/index.html +++ b/app/modules/cupang/templates/cupang/index.html @@ -249,7 +249,7 @@ {% endblock %} {% block scripts %} - + - + {% endif %} {% endblock %} diff --git a/app/modules/project/CLAUDE.md b/app/modules/project/CLAUDE.md index bc77f0e..f0260d6 100644 --- a/app/modules/project/CLAUDE.md +++ b/app/modules/project/CLAUDE.md @@ -101,7 +101,8 @@ 카드·목록·내 업무·세부 업무·업무 창 마감 칸 = `dueInfo(…, daily)` → `.is-daily`(CSS ::before repeat 아이콘 + "매일", 노랑). 알림 = `reminders.run_daily_alerts`(데몬 1분 주기, 영업일, `daily_alert_times` 중 지난 가장 늦은 시각 하나 — `task_reminders` kind `daily@HH:MM`·그날로 중복 방지) → 담당자(없으면 협업자)에게 `type=daily` 알림 → 큰 팝업 `_ALERT_TYPES` 에 포함, 줄 배경 노랑(`.pj-alert-item.is-daily`), PC 알림 프로그램 `Alert.IsDaily`. - 새 업무 만들기 칸(보드 아래 추가·세부 업무 추가 줄)에는 [매일] 없음 — 만든 뒤 날짜 칸에서. 033 미적용이면 [매일] 숨김·PUT 503·알림 skip. + 추가 칸(보드 아래 메인 업무 추가·카드 세부 업무 추가 줄)에도 [매일] — `data-daily-ready`(`db.daily_ready`), `POST …/tasks` 의 `repeat_daily: true` = 만든 뒤 `update_task` 로 켬. + 033 미적용이면 [매일] 숨김·PUT/POST 503·알림 skip. - 수신함은 확인 안 한 태그·읽지 않은 알림만(2026-10-08) — [확인] 버튼 없이 줄을 누르면 읽음·확인 처리(같은 작업 줄 함께) + 페이지 이동 없이 오른쪽 iframe 패널, 다른 줄을 고르거나 패널을 닫으면 그 줄은 목록에서 빠짐. - 나를 태그하거나 작업이 배정되면 프로젝트 화면 가운데 아래에 깜박이는 큰 팝업(닫기 전까지, `initTaskAlerts` + `GET /api/notifications/alerts`). diff --git a/app/modules/project/db.py b/app/modules/project/db.py index e4f7b61..8b36c69 100644 --- a/app/modules/project/db.py +++ b/app/modules/project/db.py @@ -1758,6 +1758,18 @@ class ProjectStore: ([int(i) for i in ordered_ids], stage_id), ) + def daily_ready(self) -> bool: + """tasks.repeat_daily(마이그레이션 033, 매일 하는 업무) 가 있는지. 한 번 켜지면 기억.""" + if getattr(self, "_daily_ready", False): + return True + with self._pool.connection() as conn: + ok = bool(conn.execute( + "SELECT 1 FROM information_schema.columns WHERE table_schema = 'public' " + "AND table_name = 'tasks' AND column_name = 'repeat_daily'" + ).fetchone()) + self._daily_ready = ok + return ok + def link_order_ready(self) -> bool: """task_project_links.sort_order(마이그레이션 032) 가 있는지. 한 번 켜지면 기억.""" if getattr(self, "_link_order_ready", False): diff --git a/app/modules/project/router.py b/app/modules/project/router.py index 86f6fb3..7b7df87 100644 --- a/app/modules/project/router.py +++ b/app/modules/project/router.py @@ -901,6 +901,7 @@ def project_page(request: Request, project_id: int) -> HTMLResponse: "user": user, **_role_ctx(user, request), "pj_options": _project_options(st), + "pj_daily_ready": st.daily_ready(), # 033 — 새 업무·세부 업무 추가 칸 날짜 팝업의 [매일] "can_manage": can_manage, "nav_items": build_erp_nav(user, active="project"), "page_title": project["name"], @@ -1549,12 +1550,22 @@ def _create_task_for( """작업 만들기 공통(작업 창 등) — 권한(멤버)·담당자 확인·만들기·자동 협업자·배정/완료 알림·@태그. 돌려주는 값: (작업, 태그하지 못한 이메일). 회의록 [적용]은 같은 확인·후처리를 쓰되 만들기만 줄 잠금 트랜잭션 안에서.""" project, followers = _task_create_checks(request, st, user, project_id, payload) + daily = payload.get("repeat_daily", False) # 추가 칸 날짜 팝업 [매일](033) — 만든 뒤 켠다(마감일은 비움) + if not isinstance(daily, bool): + raise HTTPException(status_code=400, detail="매일 반복 값이 올바르지 않습니다.") try: task = st.create_task(**_task_create_fields(user, project_id, payload)) except ValueError as exc: raise HTTPException(status_code=400, detail=str(exc)) except KeyError as exc: raise HTTPException(status_code=404, detail=str(exc)) + if daily: + try: + task = st.update_task(task_id=task["id"], fields={"repeat_daily": True}, actor=user["email"]) + except UndefinedColumn: + raise HTTPException(status_code=503, detail="DB 마이그레이션 033(매일 하는 업무)이 아직 적용되지 않았습니다.") + task.pop("_newly_assigned", None) + task.pop("_newly_completed", None) return task, _task_created_effects(request, st, user, project, task, followers, bg) diff --git a/app/modules/project/templates/project/goal_meeting.html b/app/modules/project/templates/project/goal_meeting.html index 8da0d36..c2cde64 100644 --- a/app/modules/project/templates/project/goal_meeting.html +++ b/app/modules/project/templates/project/goal_meeting.html @@ -289,5 +289,5 @@ - + {% endblock %} diff --git a/app/modules/project/templates/project/goals.html b/app/modules/project/templates/project/goals.html index 92f720c..873ebeb 100644 --- a/app/modules/project/templates/project/goals.html +++ b/app/modules/project/templates/project/goals.html @@ -207,5 +207,5 @@ {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/modules/project/templates/project/inbox.html b/app/modules/project/templates/project/inbox.html index 4aa1f73..4e8e49c 100644 --- a/app/modules/project/templates/project/inbox.html +++ b/app/modules/project/templates/project/inbox.html @@ -106,5 +106,5 @@ {% include "project/_side_modals.html" %} {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/modules/project/templates/project/mytasks.html b/app/modules/project/templates/project/mytasks.html index ee9e778..9d86221 100644 --- a/app/modules/project/templates/project/mytasks.html +++ b/app/modules/project/templates/project/mytasks.html @@ -100,5 +100,5 @@ "today": {{ today | tojson }} } - + {% endblock %} diff --git a/app/modules/project/templates/project/notifier.html b/app/modules/project/templates/project/notifier.html index ed36e19..2e53ea8 100644 --- a/app/modules/project/templates/project/notifier.html +++ b/app/modules/project/templates/project/notifier.html @@ -108,5 +108,5 @@ }); })(); - + {% endblock %} diff --git a/app/modules/project/templates/project/project.html b/app/modules/project/templates/project/project.html index 1cf9ec2..41c224a 100644 --- a/app/modules/project/templates/project/project.html +++ b/app/modules/project/templates/project/project.html @@ -27,7 +27,7 @@
- + {% endblock %} diff --git a/app/modules/project/templates/project/trash.html b/app/modules/project/templates/project/trash.html index 218485c..5854896 100644 --- a/app/modules/project/templates/project/trash.html +++ b/app/modules/project/templates/project/trash.html @@ -70,5 +70,5 @@ {% include "project/_side_modals.html" %} {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/static/project.js b/app/static/project.js index f4a5f89..4cc6359 100644 --- a/app/static/project.js +++ b/app/static/project.js @@ -3495,7 +3495,8 @@ // 등급(2026-10-12) — isPro = Pro user 이상(프로젝트 수정·멤버 배정·전체 보기·담당자별 합계·남의 댓글 수정), // isPAdmin = Admin 이상(남이 만든 섹션도 삭제). const isPro = root.dataset.isPro === "true"; - const canAllView = root.dataset.allView === "true"; // 왼쪽 "전체 보기" 메뉴 — Project 옵션 대상자(서버 pj_all_view) + const canAllView = root.dataset.allView === "true"; + const dailyReady = root.dataset.dailyReady === "1"; // 033 — 새 업무·세부 업무 추가 칸 날짜 팝업에도 [매일] // 왼쪽 "전체 보기" 메뉴 — Project 옵션 대상자(서버 pj_all_view) const isPAdmin = root.dataset.isPadmin === "true"; // 시스템 Project 옵션(서버 project_options, 수퍼관리자·Admin 이 바꾸면 모든 사용자에게) — 보드 카드 표지 켬/끔. // 옵션 창에서 저장하면 pj-options-change 로 바로 바뀐다(아래). @@ -5118,9 +5119,10 @@ av.title = draft.assignee ? idOf(draft.assignee) : "담당자 지정"; } function paintDue() { - const di = dueInfo(draft.due, false); - due.innerHTML = di ? escapeHtml(di.text) : DUE_EMPTY_ICON_SVG; - due.title = draft.due || "마감일 지정"; + const di = dueInfo(draft.due, false, draft.daily); + due.innerHTML = !di ? DUE_EMPTY_ICON_SVG + : draft.daily ? '' + escapeHtml(di.text) + "" : escapeHtml(di.text); + due.title = draft.daily ? "매일 하는 업무" : draft.due || "마감일 지정"; } function paintFol() { fol.innerHTML = followerIconHtml(draft.followers); @@ -5171,8 +5173,12 @@ }); due.addEventListener("click", function () { openDatePopover(due, { - due: draft.due, allowStart: false, - onChange: function (patch) { if (!current()) return; draft.due = patch.due_date || null; paintDue(); refocus(); }, + due: draft.due, allowStart: false, daily: !!draft.daily, allowDaily: dailyReady, + onChange: function (patch) { + if (!current()) return; + draft.due = patch.due_date || null; draft.daily = !!patch.repeat_daily; + paintDue(); refocus(); + }, }); }); function close() { @@ -5194,6 +5200,7 @@ assignee_email: draft.assignee, assignee_name: draft.assignee ? idOf(draft.assignee) : "", due_date: draft.due || null, followers: draft.followers, + ...(draft.daily ? { repeat_daily: true } : {}), }); if (!current()) return; mergeTask(res.task); @@ -6031,7 +6038,7 @@ if (!draft.followers) draft.followers = []; inp.value = draft.title; function paintDue() { - const di = dueInfo(draft.due, false); + const di = dueInfo(draft.due, false, draft.daily); dueEl.className = "pj-card-sub-due pj-card-subnew-due" + (di ? " " + di.cls : " is-empty"); dueEl.innerHTML = di ? escapeHtml(di.text) : DUE_EMPTY_ICON_SVG; dueEl.dataset.tip = di ? dueTip(di) : "마감일 지정"; @@ -6058,7 +6065,7 @@ draft.focused = document.activeElement === inp; // 날짜 팝업·담당자 메뉴를 쓰는 중이면 닫지 않는다. if (draft.focused || datePopEl || ctxMenuEl) return; - if (!draft.title.trim() && !draft.due && !draft.assignee && !draft.followers.length) closeDraft(); + if (!draft.title.trim() && !draft.due && !draft.daily && !draft.assignee && !draft.followers.length) closeDraft(); }, 150); }); inp.addEventListener("keydown", function (e) { @@ -6068,9 +6075,9 @@ }); dueEl.addEventListener("click", function () { openDatePopover(dueEl, { - due: draft.due, allowStart: false, + due: draft.due, allowStart: false, daily: !!draft.daily, allowDaily: dailyReady, // 날짜를 고르면 팝업이 닫히므로 이어서 이름을 칠 수 있게 입력칸으로 돌아간다. - onChange: function (patch) { draft.due = patch.due_date || null; paintDue(); refocus(); }, + onChange: function (patch) { draft.due = patch.due_date || null; draft.daily = !!patch.repeat_daily; paintDue(); refocus(); }, }); }); // 바깥을 누르면 Enter 와 같다 — 이름이 있으면 만들고 줄을 닫는다(아사나). 이름이 없으면 @@ -6089,7 +6096,7 @@ if (subDrafts[t.id] !== draft) return; if (inp.isConnected) draft.title = inp.value; if (draft.title.trim()) createFromDraft(false); - else if (!draft.due && !draft.assignee && !draft.followers.length) closeDraft(); + else if (!draft.due && !draft.daily && !draft.assignee && !draft.followers.length) closeDraft(); }, 0); } if (subOutsideDown[t.id]) document.removeEventListener("pointerdown", subOutsideDown[t.id], true); @@ -6138,6 +6145,7 @@ assignee_email: draft.assignee || "", assignee_name: draft.assignee ? idOf(draft.assignee) : "", followers: draft.followers, + ...(draft.daily ? { repeat_daily: true } : {}), }); const subs = subsCache[t.id] || (subsCache[t.id] = []); // 새 줄 협업자 아이콘 — 서버 자동 협업자와 같은 규칙(만든 사람·담당자·고른 협업자) diff --git a/tests/test_project_module.py b/tests/test_project_module.py index 7edcb33..f4b547d 100644 --- a/tests/test_project_module.py +++ b/tests/test_project_module.py @@ -1677,6 +1677,16 @@ def test_repeat_daily_task_and_alerts(): got = req("PUT", f"/project/api/tasks/{t['id']}", ALICE, json={"due_date": "2026-12-05"}).json()["task"] assert got["repeat_daily"] is False and got["due_date"] == "2026-12-05", got assert t["id"] not in [x["id"] for x in ST.list_open_daily_tasks()] + # 추가 칸(보드 새 업무·세부 업무)에서 [매일]로 만들기 — POST repeat_daily + r = req("POST", f"/project/api/projects/{a['id']}/tasks", ALICE, + json={"title": "매일 점검", "stage_id": sa["id"], "due_date": None, "repeat_daily": True}) + assert r.status_code == 201, r.text + assert r.json()["task"]["repeat_daily"] is True and "_newly_assigned" not in r.json()["task"] + r = req("POST", f"/project/api/projects/{a['id']}/tasks", ALICE, + json={"title": "세부 매일", "parent_task_id": t["id"], "repeat_daily": True}) + assert r.status_code == 201 and r.json()["task"]["repeat_daily"] is True, r.text + assert req("POST", f"/project/api/projects/{a['id']}/tasks", ALICE, json={"title": "x", "repeat_daily": 1}).status_code == 400 + assert ST.daily_ready() is True def test_move_stage_to_other_project():