feat(project): 세부 업무 협업자 등록·대시보드 프로젝트별·마감 지난 업무 알림
- 세부 업무를 만들 때 협업자도 같이(업무 창 추가 칸·보드 카드 새 줄) — POST tasks 의 followers, 비멤버면 400 - 보드 카드 세부 업무 줄에도 협업자 아이콘, 업무 창 줄의 빈 협업자 아이콘은 늘 보이게 - 협업자 메뉴는 고를 때마다 다시 열려 여러 명을 이어서 지정(openFollowerMenu 공용) - 대시보드 "업무 합계(프로젝트별)" 카드 — 완료 상태별 카드 왼쪽, 프로젝트별 완료/전체·완료율 - 마감 지난 내 업무 위쪽 알림(ERP 모든 화면, erp-overdue.js, GET /project/api/my-overdue) — 닫으면 1시간 뒤 다시, 새로 지난 업무는 바로 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1835,6 +1835,21 @@ class ProjectStore:
|
||||
).fetchall()
|
||||
return [dict(r) for r in rows]
|
||||
|
||||
def list_my_overdue(self, *, assignee_email: str, today: Any, limit: int = 200) -> list[dict[str, Any]]:
|
||||
"""내가 담당인 미완료 업무 중 마감일이 오늘 이전인 것(세부 업무 포함, 마감 오래된 것부터)."""
|
||||
with self._pool.connection() as conn:
|
||||
rows = conn.execute(
|
||||
"SELECT t.id, t.title, t.due_date, t.project_id, t.parent_task_id, "
|
||||
" p.name AS project_name, p.color AS project_color, pt.title AS parent_title "
|
||||
"FROM tasks t JOIN projects p ON p.id = t.project_id "
|
||||
"LEFT JOIN tasks pt ON pt.id = t.parent_task_id "
|
||||
"WHERE t.assignee_email = %s AND t.completed_at IS NULL "
|
||||
" AND t.due_date IS NOT NULL AND t.due_date < %s "
|
||||
"ORDER BY t.due_date ASC, t.id ASC LIMIT %s",
|
||||
(store.norm_str(assignee_email, lower=True), today, int(limit)),
|
||||
).fetchall()
|
||||
return [self._serialize(r) for r in rows]
|
||||
|
||||
def list_my_open_refs(self, *, assignee_email: str) -> list[dict[str, Any]]:
|
||||
"""내가 담당인 미완료 작업 전부의 (id, project_id) — "내 작업" 배지를 제한 없이 정확히 센다."""
|
||||
with self._pool.connection() as conn:
|
||||
|
||||
@@ -1448,6 +1448,18 @@ def api_my_tasks(request: Request) -> JSONResponse:
|
||||
return JSONResponse({"tasks": _my_visible_tasks(st, user)})
|
||||
|
||||
|
||||
@router.get("/api/my-overdue")
|
||||
def api_my_overdue(request: Request) -> JSONResponse:
|
||||
"""마감이 지난 내 미완료 업무(마감일이 오늘(한국시간) 이전) — ERP 모든 화면 위쪽 알림(static/erp-overdue.js)이 쓴다.
|
||||
지금 볼 수 있는 업무만, 마감이 오래된 것부터."""
|
||||
user = _require_user(request)
|
||||
st = _db_or_503(request)
|
||||
today = today_kst()
|
||||
rows = access.filter_visible_tasks(st, user, st.list_my_overdue(assignee_email=user["email"], today=today))
|
||||
keys = ("id", "title", "due_date", "project_id", "project_name", "project_color", "parent_task_id", "parent_title")
|
||||
return JSONResponse({"today": today.isoformat(), "tasks": [{k: t.get(k) for k in keys} for t in rows]})
|
||||
|
||||
|
||||
@router.get("/api/my-tasks/open-count")
|
||||
def api_my_open_count(request: Request) -> JSONResponse:
|
||||
"""사이드바 "내 업무" 배지 숫자만 — 목록 전체를 받지 않는다."""
|
||||
@@ -1480,6 +1492,7 @@ def _create_task_for(
|
||||
if project is None:
|
||||
raise HTTPException(status_code=404, detail="프로젝트를 찾을 수 없습니다.")
|
||||
_check_assignee(st, payload.get("assignee_email"), project_id)
|
||||
followers = _check_followers(st, payload.get("followers"), project_id)
|
||||
try:
|
||||
task = st.create_task(
|
||||
project_id=project_id,
|
||||
@@ -1501,8 +1514,8 @@ def _create_task_for(
|
||||
raise HTTPException(status_code=400, detail=str(exc))
|
||||
except KeyError as exc:
|
||||
raise HTTPException(status_code=404, detail=str(exc))
|
||||
# 만든 사람·담당자는 자동 팔로워(아사나와 같은 규칙)
|
||||
_follow(st, task["id"], [user["email"], task.get("assignee_email") or ""])
|
||||
# 만든 사람·담당자는 자동 팔로워(아사나와 같은 규칙) + 만들 때 고른 협업자(세부 업무 추가 칸 등)
|
||||
_follow(st, task["id"], [user["email"], task.get("assignee_email") or ""] + followers)
|
||||
# 생성과 동시에 담당자 지정 시 관리자 메일 + 담당자 인앱 알림
|
||||
if task.get("assignee_email"):
|
||||
_notify(
|
||||
@@ -1541,6 +1554,19 @@ def _create_task_for(
|
||||
_ASSIGNEE_DENIED = "담당자는 이 프로젝트를 볼 수 있는 사람(멤버·소유자·관리자)이어야 합니다."
|
||||
|
||||
|
||||
def _check_followers(st: Any, raw: Any, project_id: int) -> list[str]:
|
||||
"""업무를 만들 때 같이 고른 협업자 — 협업자 추가 API 와 같은 기준(그 프로젝트를 볼 수 있는 사람만, 아니면 400)."""
|
||||
if not raw:
|
||||
return []
|
||||
if not isinstance(raw, list):
|
||||
raise HTTPException(status_code=400, detail="협업자 목록이 올바르지 않습니다.")
|
||||
emails = store.normalize_emails([str(e) for e in raw])
|
||||
for em in emails:
|
||||
if not access.can_assign(st, em, project_id):
|
||||
raise HTTPException(status_code=400, detail="이 프로젝트 멤버만 협업자로 추가할 수 있습니다.")
|
||||
return emails
|
||||
|
||||
|
||||
def _check_assignee(st: Any, email: Any, project_id: int, *, previous: str = "") -> None:
|
||||
"""새로 지정하는 담당자가 그 프로젝트를 볼 수 있는지 — 권한 없는 사람에게 배정 알림(작업 제목
|
||||
등)이 가지 않게. 비우거나 그대로 두는 건 검사하지 않는다(멤버에서 빠진 예전 담당자 보존)."""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "project/_meeting_content_base.html" if meeting_embedded else "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -298,5 +298,5 @@
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project-meeting-cells.js?v=20261012a" defer></script>
|
||||
<script src="/static/project.js?v=20261013a" defer></script>
|
||||
<script src="/static/project.js?v=20261013b" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -207,5 +207,5 @@
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project.js?v=20261013a" defer></script>
|
||||
<script src="/static/project.js?v=20261013b" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<link rel="stylesheet" href="/static/project-help.css?v=20261003a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -102,5 +102,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261013a" defer></script>
|
||||
<script src="/static/project.js?v=20261013b" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -100,5 +100,5 @@
|
||||
"today": {{ today | tojson }}
|
||||
}
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261013a" defer></script>
|
||||
<script src="/static/project.js?v=20261013b" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -108,5 +108,5 @@
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261013a" defer></script>
|
||||
<script src="/static/project.js?v=20261013b" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<!-- 타임라인 vis-timeline — self-host -->
|
||||
@@ -365,6 +365,7 @@
|
||||
<div class="pj-subtask-form">
|
||||
<input type="text" id="pj-subtask-input" placeholder="세부 업무 제목…" autocomplete="off" />
|
||||
<select id="pj-subtask-add-assignee"><option value="">담당자 없음</option></select>
|
||||
<button type="button" class="pj-assignee-btn is-empty pj-subtask-add-fol" id="pj-subtask-add-followers" title="협업자 지정">협업자 없음</button>
|
||||
<input type="date" id="pj-subtask-add-due" />
|
||||
<button type="button" class="pj-btn pj-btn-primary" id="pj-subtask-add">추가</button>
|
||||
</div>
|
||||
@@ -468,5 +469,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20261013a" defer></script>
|
||||
<script src="/static/project.js?v=20261013b" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013a" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261013b" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -70,5 +70,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261013a" defer></script>
|
||||
<script src="/static/project.js?v=20261013b" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user