Merge branch 'feat/stage-color-alerts-meeting-lock'
This commit is contained in:
@@ -2573,6 +2573,41 @@ class ProjectStore:
|
||||
self._meeting_v20_ok = True
|
||||
return ok
|
||||
|
||||
def _meeting_v22(self, conn: Any) -> bool:
|
||||
"""마이그레이션 022 — 회의 완료(goal_meetings.completed_at, 수정 잠금)."""
|
||||
if getattr(self, "_meeting_v22_ok", False):
|
||||
return True
|
||||
ok = self._column_exists(conn, "goal_meetings", "completed_at")
|
||||
if ok:
|
||||
self._meeting_v22_ok = True
|
||||
return ok
|
||||
|
||||
def _check_meeting_open(self, conn: Any, week_start: Any) -> None:
|
||||
"""그 주차 회의록이 완료(잠금)됐으면 MeetingLocked. 022 전이면 잠금 없음."""
|
||||
if not self._meeting_v22(conn):
|
||||
return
|
||||
row = conn.execute("SELECT completed_at FROM goal_meetings WHERE week_start = %s", (week_start,)).fetchone()
|
||||
if row and row["completed_at"] is not None:
|
||||
raise store.MeetingLocked()
|
||||
|
||||
def set_meeting_completed(self, *, week_start: date, done: bool, by: str = "") -> dict[str, Any]:
|
||||
"""회의 완료(잠금)·완료 해제 — 관리자만(라우터). 바뀐 상태를 돌려준다."""
|
||||
with self._pool.connection() as conn:
|
||||
self._require_meetings(conn)
|
||||
if not self._meeting_v22(conn):
|
||||
raise store.MeetingMigration022Needed()
|
||||
row = conn.execute(
|
||||
"UPDATE goal_meetings SET completed_at = CASE WHEN %s THEN COALESCE(completed_at, now()) ELSE NULL END, "
|
||||
"completed_by = CASE WHEN %s THEN %s ELSE '' END, updated_at = now() "
|
||||
"WHERE week_start = %s RETURNING completed_at, completed_by",
|
||||
(done, done, store.norm_str(by, lower=True), week_start),
|
||||
).fetchone()
|
||||
if row is None:
|
||||
raise KeyError(str(week_start))
|
||||
return {"completed": row["completed_at"] is not None,
|
||||
"completed_at": row["completed_at"].astimezone(KST).isoformat(timespec="minutes") if row["completed_at"] else "",
|
||||
"completed_by": row["completed_by"] or ""}
|
||||
|
||||
def meetings_v20(self) -> bool:
|
||||
with self._pool.connection() as conn:
|
||||
return self._table_exists(conn, "goal_meetings") and self._meeting_v20(conn)
|
||||
@@ -2585,14 +2620,16 @@ class ProjectStore:
|
||||
self._meeting_cells_ok = True
|
||||
return ok
|
||||
|
||||
def _locked_meeting_items(self, conn: Any, item_id: int) -> list[dict[str, Any]]:
|
||||
"""글 저장·이동·병합·줄 변경이 같은 주 잠금을 공유한다."""
|
||||
def _locked_meeting_items(self, conn: Any, item_id: int, *, check_open: bool = True) -> list[dict[str, Any]]:
|
||||
"""글 저장·이동·병합·줄 변경이 같은 주 잠금을 공유한다. check_open — 회의 완료(022)된 주면 MeetingLocked."""
|
||||
me = conn.execute("SELECT week_start FROM goal_meeting_items WHERE id = %s", (item_id,)).fetchone()
|
||||
if me is None:
|
||||
raise KeyError(item_id)
|
||||
if not conn.execute("SELECT week_start FROM goal_meetings WHERE week_start = %s FOR UPDATE",
|
||||
(me["week_start"],)).fetchone():
|
||||
raise KeyError(item_id)
|
||||
if check_open:
|
||||
self._check_meeting_open(conn, me["week_start"])
|
||||
rows = conn.execute(f"SELECT {self._meeting_cols(conn)} FROM goal_meeting_items "
|
||||
"WHERE week_start = %s ORDER BY sort_order, id FOR UPDATE", (me["week_start"],)).fetchall()
|
||||
if not any(int(r["id"]) == item_id for r in rows):
|
||||
@@ -2655,6 +2692,9 @@ class ProjectStore:
|
||||
keyed = self._meeting_keys(conn)
|
||||
cell_merges = self._meeting_cells(conn)
|
||||
result_notes = self._meeting_v20(conn)
|
||||
v22 = self._meeting_v22(conn)
|
||||
done_row = conn.execute("SELECT completed_at, completed_by FROM goal_meetings WHERE week_start = %s",
|
||||
(week_start,)).fetchone() if v22 else None
|
||||
head = conn.execute(
|
||||
"SELECT week_start, week_target, attendees, notes, updated_by, updated_at "
|
||||
"FROM goal_meetings WHERE week_start = %s", (week_start,),
|
||||
@@ -2695,6 +2735,11 @@ class ProjectStore:
|
||||
"line_keys": keyed,
|
||||
"cell_merges": cell_merges,
|
||||
"result_notes": result_notes,
|
||||
"can_complete": v22,
|
||||
"completed": bool(done_row and done_row["completed_at"] is not None),
|
||||
"completed_at": done_row["completed_at"].astimezone(KST).strftime("%Y-%m-%d %H:%M")
|
||||
if done_row and done_row["completed_at"] else "",
|
||||
"completed_by": (done_row["completed_by"] or "") if done_row else "",
|
||||
}
|
||||
|
||||
def create_meeting(self, *, week_start: date, sections: list[tuple[str, str]], created_by: str = "") -> bool:
|
||||
@@ -2804,6 +2849,7 @@ class ProjectStore:
|
||||
return
|
||||
with self._pool.connection() as conn:
|
||||
self._require_meetings(conn)
|
||||
self._check_meeting_open(conn, week_start)
|
||||
row = conn.execute(
|
||||
f"UPDATE goal_meetings SET {', '.join(sets)}, updated_by = %s, updated_at = now() "
|
||||
"WHERE week_start = %s RETURNING week_start",
|
||||
@@ -2830,6 +2876,7 @@ class ProjectStore:
|
||||
"SELECT 1 FROM goal_meetings WHERE week_start = %s FOR UPDATE", (week_start,)
|
||||
).fetchone():
|
||||
raise KeyError(str(week_start))
|
||||
self._check_meeting_open(conn, week_start)
|
||||
rows = conn.execute(
|
||||
f"SELECT {self._meeting_cols(conn)} FROM goal_meeting_items WHERE week_start = %s "
|
||||
"ORDER BY sort_order, id", (week_start,),
|
||||
@@ -2902,13 +2949,18 @@ class ProjectStore:
|
||||
self._require_meetings(conn)
|
||||
if "result_note" in fields and not self._meeting_v20(conn):
|
||||
raise store.MeetingMigration020Needed()
|
||||
result_only = bool(fields) and set(fields) <= {"result_note", "result_amount", "status"}
|
||||
if self._meeting_v21(conn):
|
||||
for col, text, _err in texts:
|
||||
sets.append(f"{col} = %s")
|
||||
params.append(text)
|
||||
elif any(text for _c, text, _e in texts):
|
||||
raise ValueError(next(e for _c, t, e in texts if t)) # 021 전 — 예전처럼 숫자만
|
||||
rows = self._locked_meeting_items(conn, item_id)
|
||||
rows = self._locked_meeting_items(conn, item_id, check_open=not result_only)
|
||||
if result_only:
|
||||
# 지난주 결과는 다음 주 회의에서 적는다 — 그 회의록(바로 다음 주차)이 완료됐으면 잠금
|
||||
own = next(r for r in rows if int(r["id"]) == item_id)["week_start"]
|
||||
self._check_meeting_open(conn, store.week_period(own)[1] + timedelta(days=1))
|
||||
if "content" in fields:
|
||||
self._require_meeting_cell_visible(rows, item_id)
|
||||
if sets:
|
||||
|
||||
@@ -2292,6 +2292,26 @@ def api_notifications(request: Request) -> JSONResponse:
|
||||
return JSONResponse({"notifications": items, "unread": _notification_unread(st, user)})
|
||||
|
||||
|
||||
@router.get("/api/notifications/alerts")
|
||||
def api_notification_alerts(request: Request, after: int = -1) -> JSONResponse:
|
||||
"""화면 가운데 아래 큰 팝업용(2026-10-07) — 나를 태그(mention)하거나 작업을 배정(assigned)한, 읽지 않은 알림 중
|
||||
id 가 after 보다 큰 것(오래된 것부터 최대 10, 지금 볼 수 있는 작업만). after 없이 부르면 기준점(latest_id)만 —
|
||||
처음 쓰는 브라우저가 쌓인 옛 알림을 한꺼번에 띄우지 않게."""
|
||||
user = _require_user(request)
|
||||
st = _db_or_503(request)
|
||||
newest = st.list_notifications(recipient_email=user["email"], limit=1)
|
||||
latest = int(newest[0]["id"]) if newest else 0
|
||||
out: dict[str, Any] = {"me": store.norm_str(user["email"], lower=True), "latest_id": latest, "alerts": []}
|
||||
if after < 0:
|
||||
return JSONResponse(out)
|
||||
rows = [n for n in st.list_notifications(recipient_email=user["email"], unread_only=True, limit=50)
|
||||
if n.get("type") in ("mention", "assigned") and int(n["id"]) > after]
|
||||
rows = sorted(_visible_notifications(st, user, rows), key=lambda n: int(n["id"]))[:10]
|
||||
out["alerts"] = [{k: n.get(k) for k in ("id", "type", "title", "body", "task_id", "project_id", "actor_email", "created_at")}
|
||||
for n in rows]
|
||||
return JSONResponse(out)
|
||||
|
||||
|
||||
@router.get("/api/notifications/unread-count")
|
||||
def api_notif_count(request: Request) -> JSONResponse:
|
||||
user = _require_user(request)
|
||||
@@ -2627,6 +2647,10 @@ def _goal_call(fn: Any, *args: Any, **kwargs: Any) -> Any:
|
||||
raise HTTPException(status_code=503, detail=_GOALS_017_MSG)
|
||||
except store.MeetingCellMigrationNeeded:
|
||||
raise HTTPException(status_code=503, detail="회의록 셀 병합은 project_db 마이그레이션 019 적용 후 사용할 수 있습니다.")
|
||||
except store.MeetingLocked:
|
||||
raise HTTPException(status_code=409, detail="회의가 완료되어 수정할 수 없습니다. 관리자가 [완료 해제]하면 다시 고칠 수 있습니다.")
|
||||
except store.MeetingMigration022Needed:
|
||||
raise HTTPException(status_code=503, detail="회의 완료 기능은 project_db 마이그레이션 022 적용 후 사용할 수 있습니다.")
|
||||
except store.MeetingMigration020Needed:
|
||||
raise HTTPException(status_code=503, detail="새 주차·결과 글·주차별 목표는 project_db 마이그레이션 020 적용 후 사용할 수 있습니다.")
|
||||
except store.GoalCellConflict as exc:
|
||||
@@ -3273,7 +3297,7 @@ def api_get_meeting(request: Request, week_start: str, year: int, month: int) ->
|
||||
@router.post("/api/goals/meetings/{week_start}")
|
||||
def api_create_meeting(request: Request, week_start: str, payload: dict[str, Any] = Body(default={})) -> JSONResponse:
|
||||
"""회의록 만들기(관리자) — 앞선 회의록 줄을 이어받거나, 처음이면 그 해 목표 표 업무 영역 + 기본 양식 줄."""
|
||||
user = _require_admin(request)
|
||||
user = _require_user(request)
|
||||
st = _db_or_503(request)
|
||||
ws = _goal_call(store.validate_period_start, week_start)
|
||||
year = _goal_call(store.validate_goal_year, payload.get("year") or ws.year)
|
||||
@@ -3284,7 +3308,7 @@ def api_create_meeting(request: Request, week_start: str, payload: dict[str, Any
|
||||
|
||||
@router.put("/api/goals/meetings/{week_start}")
|
||||
def api_update_meeting(request: Request, week_start: str, payload: dict[str, Any] = Body(...)) -> JSONResponse:
|
||||
user = _require_admin(request)
|
||||
user = _require_user(request)
|
||||
st = _db_or_503(request)
|
||||
ws = _goal_call(store.validate_week_start, week_start)
|
||||
fields = {k: payload[k] for k in ("week_target", "attendees", "notes") if k in payload}
|
||||
@@ -3318,6 +3342,17 @@ def api_open_meeting_board(request: Request, week_start: str) -> JSONResponse:
|
||||
return JSONResponse({"ok": True, "url": board["url"], "created": board["created"], "title": title})
|
||||
|
||||
|
||||
@router.post("/api/goals/meetings/{week_start}/complete")
|
||||
def api_complete_meeting(request: Request, week_start: str, payload: dict[str, Any] = Body(default={})) -> JSONResponse:
|
||||
"""회의 완료(수정 잠금) {done: true} · 완료 해제 {done: false} — 관리자만(2026-10-07, 마이그레이션 022)."""
|
||||
user = _require_admin(request)
|
||||
st = _db_or_503(request)
|
||||
ws = _goal_call(store.validate_week_start, week_start)
|
||||
done = payload.get("done", True) is not False
|
||||
out = _goal_call(st.set_meeting_completed, week_start=ws, done=done, by=user["email"])
|
||||
return JSONResponse({"ok": True, **out})
|
||||
|
||||
|
||||
@router.delete("/api/goals/meetings/{week_start}")
|
||||
def api_delete_meeting(request: Request, week_start: str) -> JSONResponse:
|
||||
_require_admin(request)
|
||||
@@ -3330,7 +3365,7 @@ def api_delete_meeting(request: Request, week_start: str) -> JSONResponse:
|
||||
@router.post("/api/goals/meetings/{week_start}/items")
|
||||
def api_add_meeting_item(request: Request, week_start: str, payload: dict[str, Any] = Body(...)) -> JSONResponse:
|
||||
"""줄 추가 {section, label?, ref_item_id?, place?: above|below} — 기준 줄 위/아래, 없으면 구역 끝(새 구역이면 맨 끝)."""
|
||||
user = _require_admin(request)
|
||||
user = _require_user(request)
|
||||
st = _db_or_503(request)
|
||||
ws = _goal_call(store.validate_week_start, week_start)
|
||||
ref = payload.get("ref_item_id")
|
||||
@@ -3349,7 +3384,7 @@ def api_add_meeting_item(request: Request, week_start: str, payload: dict[str, A
|
||||
def api_update_meeting_item(request: Request, item_id: int, payload: dict[str, Any] = Body(...)) -> JSONResponse:
|
||||
"""줄 칸 하나 — label·content·target_amount·result_amount(숫자 아니면 글 — 021)·result_note(020)·status·marketplace_code.
|
||||
지난주 결과(글·금액)는 이번 회의 화면에서 지난 주차 줄(prev)에 저장한다."""
|
||||
user = _require_admin(request)
|
||||
user = _require_user(request)
|
||||
st = _db_or_503(request)
|
||||
keys = ("label", "content", "target_amount", "result_amount", "result_note", "status", "marketplace_code")
|
||||
item = _goal_call(st.update_meeting_item, item_id=item_id,
|
||||
@@ -3359,7 +3394,7 @@ def api_update_meeting_item(request: Request, item_id: int, payload: dict[str, A
|
||||
|
||||
@router.delete("/api/goals/meeting-items/{item_id}")
|
||||
def api_delete_meeting_item(request: Request, item_id: int) -> JSONResponse:
|
||||
_require_admin(request)
|
||||
_require_user(request)
|
||||
st = _db_or_503(request)
|
||||
_goal_call(st.delete_meeting_item, item_id=item_id)
|
||||
return JSONResponse({"ok": True})
|
||||
@@ -3367,7 +3402,7 @@ def api_delete_meeting_item(request: Request, item_id: int) -> JSONResponse:
|
||||
|
||||
@router.post("/api/goals/meeting-cells/move")
|
||||
def api_move_meeting_cell(request: Request, payload: dict[str, Any] = Body(...)) -> JSONResponse:
|
||||
user = _require_admin(request)
|
||||
user = _require_user(request)
|
||||
st = _db_or_503(request)
|
||||
if not all(k in payload for k in ("source_item", "target_item", "source_body", "target_body")):
|
||||
raise HTTPException(status_code=400, detail="원본·대상 셀과 예상 내용을 함께 보내 주세요.")
|
||||
@@ -3378,7 +3413,7 @@ def api_move_meeting_cell(request: Request, payload: dict[str, Any] = Body(...))
|
||||
|
||||
@router.post("/api/goals/meeting-cells/merge")
|
||||
def api_merge_meeting_cells(request: Request, payload: dict[str, Any] = Body(...)) -> JSONResponse:
|
||||
user = _require_admin(request)
|
||||
user = _require_user(request)
|
||||
result = _goal_call(_db_or_503(request).merge_meeting_cells, item_from=payload.get("item_from"),
|
||||
item_to=payload.get("item_to"), updated_by=user["email"])
|
||||
return JSONResponse({"ok": True, **result})
|
||||
@@ -3386,14 +3421,14 @@ def api_merge_meeting_cells(request: Request, payload: dict[str, Any] = Body(...
|
||||
|
||||
@router.delete("/api/goals/meeting-items/{item_id}/cell-merge")
|
||||
def api_unmerge_meeting_cell(request: Request, item_id: int) -> JSONResponse:
|
||||
user = _require_admin(request)
|
||||
user = _require_user(request)
|
||||
_goal_call(_db_or_503(request).unmerge_meeting_cell, item_id=item_id, updated_by=user["email"])
|
||||
return JSONResponse({"ok": True})
|
||||
|
||||
|
||||
@router.post("/api/goals/meeting-items/{item_id}/move")
|
||||
def api_move_meeting_item(request: Request, item_id: int, payload: dict[str, Any] = Body(...)) -> JSONResponse:
|
||||
_require_admin(request)
|
||||
_require_user(request)
|
||||
st = _db_or_503(request)
|
||||
_goal_call(st.move_meeting_item, item_id=item_id, direction=int(payload.get("direction") or 0))
|
||||
return JSONResponse({"ok": True})
|
||||
|
||||
@@ -405,6 +405,14 @@ class MeetingCellMigrationNeeded(RuntimeError):
|
||||
"""회의록 셀 병합 메타데이터(019)가 아직 없다."""
|
||||
|
||||
|
||||
class MeetingLocked(RuntimeError):
|
||||
"""회의 완료(022)된 회의록은 고칠 수 없다(관리자가 완료 해제하면 다시)."""
|
||||
|
||||
|
||||
class MeetingMigration022Needed(RuntimeError):
|
||||
"""회의 완료(잠금)는 마이그레이션 022 뒤에만 된다."""
|
||||
|
||||
|
||||
class MeetingMigration020Needed(RuntimeError):
|
||||
"""새 주차(월요일이 아닌 시작일)·결과 글 칸·주차별 목표는 마이그레이션 020 뒤에만 된다."""
|
||||
|
||||
|
||||
@@ -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=20261007g" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261007h" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -38,10 +38,16 @@
|
||||
<a class="pj-btn pj-btn-sm" href="/project/goals/{{ py }}/meetings/{{ pm }}">‹ {{ pm }}월</a>
|
||||
<a class="pj-btn pj-btn-sm" href="/project/goals/{{ ny }}/meetings/{{ nm }}">{{ nm }}월 ›</a>
|
||||
{% if meeting %}
|
||||
{# 회의록은 프로젝트 권한이 있는 누구나 고친다. [회의 완료](관리자) = 수정 잠금, 완료 뒤 [완료 해제](관리자) — 마이그레이션 022 #}
|
||||
<span class="pj-meet-title-acts">
|
||||
<button type="button" class="pj-btn pj-btn-sm" id="pj-meet-print"><span class="material-symbols-outlined">print</span> 인쇄</button>
|
||||
{% if is_admin %}<button type="button" class="pj-btn pj-btn-sm pj-btn-danger" id="pj-meet-del">회의록 삭제</button>
|
||||
{% else %}<span class="pj-goal-note">회의록은 관리자만 입력할 수 있습니다.</span>{% endif %}
|
||||
{% if is_admin %}<button type="button" class="pj-btn pj-btn-sm pj-btn-danger" id="pj-meet-del">회의록 삭제</button>{% endif %}
|
||||
{% if meeting.can_complete %}
|
||||
{% if meeting.completed %}
|
||||
<span class="pj-meet-done-badge" title="{{ meeting.completed_at }}{% if meeting.completed_by %} · {{ meeting.completed_by }}{% endif %} — 완료된 회의록은 고칠 수 없습니다"><span class="material-symbols-outlined">lock</span>회의 완료</span>
|
||||
{% if is_admin %}<button type="button" class="pj-btn pj-btn-sm" id="pj-meet-reopen" title="다시 고칠 수 있게 엽니다">완료 해제</button>{% endif %}
|
||||
{% elif is_admin %}<button type="button" class="pj-btn pj-btn-sm pj-meet-complete-btn" id="pj-meet-complete" title="이 회의록을 더 고칠 수 없게 잠급니다(관리자)"><span class="material-symbols-outlined">task_alt</span>회의 완료</button>{% endif %}
|
||||
{% endif %}
|
||||
</span>
|
||||
{% endif %}
|
||||
{# 주차 탭 — 주차는 그 달 안(1일이 월~금이면 1일~일요일, 토·일이면 1일~다음 주 일요일, 말일이 월·화면 앞 주차에 붙음). 점 = 회의록 있음 #}
|
||||
@@ -106,7 +112,7 @@
|
||||
<section class="pj-meet-area pj-meet-notes">
|
||||
<h3>결정사항 : 진행상황 수시 공유 및 완료 되어야 함</h3>
|
||||
{% if meeting %}
|
||||
{% if is_admin %}<textarea id="pj-meet-notes" rows="4" placeholder="이번 회의에서 정한 것, 다음 주까지 확인할 것">{{ meeting.notes }}</textarea>
|
||||
{% if not meeting.completed %}<textarea id="pj-meet-notes" rows="4" placeholder="이번 회의에서 정한 것, 다음 주까지 확인할 것">{{ meeting.notes }}</textarea>
|
||||
{% else %}<div class="pj-meet-ro">{{ meeting.notes or '—' }}</div>{% endif %}
|
||||
{% else %}<p class="pj-meet-plan-empty">이 주차 회의록을 만들면 적을 수 있습니다.</p>{% endif %}
|
||||
</section>
|
||||
@@ -136,23 +142,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if is_admin and meeting %}{% include "project/_cell_format.html" %}{% endif %}
|
||||
{% if meeting and not meeting.completed %}{% include "project/_cell_format.html" %}{% endif %}
|
||||
<div class="pj-view pj-meet-pane" id="pj-meet-pane" data-week="{{ week }}" data-year="{{ goal_year }}"
|
||||
data-month="{{ goal_month }}" data-admin="{{ 'true' if is_admin else 'false' }}">
|
||||
data-month="{{ goal_month }}" data-admin="{{ 'true' if is_admin else 'false' }}"
|
||||
data-edit="{{ 'true' if meeting and not meeting.completed else 'false' }}">
|
||||
|
||||
{% if not meetings_enabled %}
|
||||
<div class="pj-empty">주간 회의록이 아직 준비되지 않았습니다(DB 마이그레이션 015 필요).</div>
|
||||
{% elif not meeting %}
|
||||
<div class="pj-empty pj-goal-empty">
|
||||
<p>{{ week_n }}주차({{ week }} ~ {{ week_end }}) 회의록이 아직 없습니다.</p>
|
||||
{% if is_admin %}
|
||||
{% if true %}
|
||||
<p class="pj-goal-empty-sub">만들면 앞선 회의록의 줄(구역·항목)을 이어받아, 지난주 업무·목표·결과를 나란히 리뷰할 수 있습니다.
|
||||
처음이면 {{ goal_year }}년 목표 표의 업무 영역과 기본 양식 줄로 시작합니다.</p>
|
||||
<button type="button" class="pj-btn pj-btn-primary" id="pj-meet-create">{{ week_n }}주차 회의록 만들기</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% set edit = is_admin %}
|
||||
{% set edit = not meeting.completed %} {# 누구나 고친다 — 회의 완료(022)면 잠금 #}
|
||||
{# 매출 자료 갱신 — 주차를 열면 실적 모듈 매출 업데이트(지난 주차 시작 ~ 이 주차 오늘)를 한 번 더 돌리고 숫자 칸만 다시 그린다
|
||||
(project.js initMeetingSync, 같은 주는 10분에 한 번). 정상이면 아무것도 보이지 않는다(2026-10-01 요청 — 큰 상태 줄 없음).
|
||||
실패·일부 실패면 이 작은 안내 + [다시 시도], 실적 권한이 없으면 부르지 않고 한 줄 설명. 마지막 갱신 성공 시각은 서버 기록(data-fresh). #}
|
||||
@@ -281,5 +288,5 @@
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project-meeting-cells.js?v=20261007a" defer></script>
|
||||
<script src="/static/project.js?v=20261007l" defer></script>
|
||||
<script src="/static/project.js?v=20261007m" defer></script>
|
||||
{% 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=20261007l" defer></script>
|
||||
<script src="/static/project.js?v=20261007m" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -392,7 +392,7 @@
|
||||
<li>기간이 있는(시작일 또는 마감일이 있는) 작업이 가로 막대로 나옵니다. <b>이 프로젝트</b>는 섹션별 줄, <b>전체 프로젝트</b>는 프로젝트별 줄이며 프로젝트 전체 기간이 옅은 배경으로 깔립니다.</li>
|
||||
<li>작업은 아사나처럼 <b>카드</b>로 보입니다 — 담당자 사진 · 제목 · 하위 작업이 있으면 <span class="pjh-ui">N ⤷</span> · 댓글이 있으면 <span class="pjh-ui">💬 N</span>(누르면 댓글 대화창), 아래 줄에 “마감일: 9월 23일”처럼 날짜. 기간이 있는 작업은 기간만큼 막대로 늘어납니다.</li>
|
||||
<li>카드에 하위 작업이 있으면 <span class="pjh-ui">N ⤷</span>(마우스를 올리면 “하위 작업 N개”), 설명이 있으면 줄글 아이콘이 붙습니다. 하위 작업은 작업 편집 창에서 봅니다.</li>
|
||||
<li>줄 색은 <b>섹션 편집에서 정한 섹션 색</b>입니다(색이 없는 섹션은 프로젝트 색). 왼쪽 섹션 이름 앞에도 같은 색 네모가 붙습니다. 주말은 세로줄이 옅은 회색입니다.</li>
|
||||
<li>줄 색은 <b>프로젝트 색</b>입니다(섹션별 색 지정은 없앴습니다 — 보드의 섹션 머리는 모두 같은 연회색). 주말은 세로줄이 옅은 회색입니다.</li>
|
||||
<li>카드(막대)를 <b>바로 끌면</b> 하루 단위로 기간 전체가 이동하고(하루짜리 작업은 마감일이 옮겨집니다), 기간 막대의 <b>양 끝을 끌면</b> 시작일이나 마감일만 바뀝니다. 먼저 눌러 선택하지 않아도 됩니다.</li>
|
||||
<li>처음 열면 하루 칸이 날짜 글자(“30일 (수)”) 폭만큼이라 한 화면에 여러 날이 보입니다. <kbd>Ctrl</kbd> + 마우스 휠로 확대·축소(하루 칸이 날짜 글자 폭이 되면 더 줄어들지 않습니다), 빈 곳을 끌면 좌우로 이동합니다(보던 구간은 기억). <span class="pjh-ui">오늘</span>로 오늘 날짜로 돌아옵니다.</li>
|
||||
<li>아래 날짜 줄은 캘린더와 같은 색입니다 — <span style="color:#1d4ed8;font-weight:700">토요일은 파랑</span>, <span style="color:#c22b10;font-weight:700">일요일·국경일·대체공휴일은 빨강</span>. 공휴일은 날짜 밑에 이름(예: 추석, 대체휴일)이 나오고, 마우스를 올리면 전체 이름이 보입니다.</li>
|
||||
@@ -568,7 +568,8 @@
|
||||
<!-- 21. 주간 회의록 -->
|
||||
<section class="pjh-sec" id="meetings">
|
||||
<h2><span class="pjh-num">21</span>주간 회의록</h2>
|
||||
<p class="pjh-lead">월 목표를 기준으로 지난주 결과를 리뷰하고 이번주 주요 업무와 금액 목표를 정하는 화면입니다. 연간 목표의 월 계획, 실적 모듈의 매출, 주별 결정 사항을 함께 확인합니다. 직원은 조회할 수 있고, 생성·입력·삭제는 관리자만 할 수 있습니다.</p>
|
||||
<p class="pjh-lead">월 목표를 기준으로 지난주 결과를 리뷰하고 이번주 주요 업무와 금액 목표를 정하는 화면입니다. 연간 목표의 월 계획, 실적 모듈의 매출, 주별 결정 사항을 함께 확인합니다. 프로젝트 관리 권한이 있는 직원은 <b>누구나 회의록을 만들고 고칠 수 있습니다</b>. 관리자가 <span class="pjh-ui">회의 완료</span>를 누르면 그 회의록은 아무도 고칠 수 없게 잠기고(🔒 회의 완료 표시), 관리자는 <span class="pjh-ui">완료 해제</span>로 다시 열 수 있습니다. 회의록 삭제도 관리자만 합니다.</p>
|
||||
<div class="pjh-tip"><span class="material-symbols-outlined">lightbulb</span><div>지난주 리뷰의 <b>결과</b>(글·금액)는 다음 주 회의에서 적는 값이라, 지난주 회의록이 완료돼 있어도 이번 주 회의록이 열려 있으면 적을 수 있습니다. 이번 주 회의록까지 완료하면 함께 잠깁니다.</div></div>
|
||||
|
||||
<h3 id="meetings-week">회의록 열기와 주차 기준</h3>
|
||||
<p>왼쪽 연도 앞 화살표를 누르면 해당 연도의 하위 월 전체를 접거나 펼칠 수 있습니다. 연도 글자를 누르면 연간 목표를 엽니다. 연도와 월의 접기·펼치기 선택은 이 브라우저에 기억됩니다.</p>
|
||||
|
||||
@@ -104,5 +104,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261007l" defer></script>
|
||||
<script src="/static/project.js?v=20261007m" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -100,5 +100,5 @@
|
||||
"today": {{ today | tojson }}
|
||||
}
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261007l" defer></script>
|
||||
<script src="/static/project.js?v=20261007m" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -213,9 +213,6 @@
|
||||
<h3 id="pj-stage-modal-title">새 섹션</h3>
|
||||
<input type="hidden" id="pj-stg-id" />
|
||||
<label>이름<input type="text" id="pj-stg-name" placeholder="섹션 이름" autocomplete="off" /></label>
|
||||
<label>색상
|
||||
<span class="pj-color-palette" id="pj-stg-colors"></span>
|
||||
</label>
|
||||
<div class="pj-field-label">기본 담당자
|
||||
<div class="pj-member-picker" id="pj-stg-assignee"></div>
|
||||
<span class="pj-modal-hint pj-stg-assignee-hint">이 섹션에 작업을 새로 만들거나 카드를 옮겨오면, 담당자가 비어 있는 작업만 이 사람에게 자동 배정됩니다.</span>
|
||||
@@ -487,5 +484,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20261007l" defer></script>
|
||||
<script src="/static/project.js?v=20261007m" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -70,5 +70,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261007l" defer></script>
|
||||
<script src="/static/project.js?v=20261007m" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -2680,6 +2680,14 @@ html.pj-goal-selecting, html.pj-goal-selecting * { user-select: none !important;
|
||||
/* 참석자 — 멤버 칩 + [참석자] 고르기 창(body 에 붙음) */
|
||||
.pj-meet-attend { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 10px; font-size: 12.5px; }
|
||||
.pj-meet-attend-label { font-weight: 600; color: var(--pj-ink-soft); line-height: 30px; flex: none; }
|
||||
/* 회의 완료(잠금) — 관리자 버튼 · 완료 표시 */
|
||||
.pj-meet-complete-btn { gap: 4px; background: #e7f6ec; border-color: #b9e3c8; color: #1f7a44; }
|
||||
.pj-meet-complete-btn:hover { background: #d6f0df; }
|
||||
.pj-meet-complete-btn .material-symbols-outlined, .pj-meet-done-badge .material-symbols-outlined { font-size: 16px; }
|
||||
.pj-meet-done-badge {
|
||||
display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: 999px;
|
||||
background: #eef0f3; color: #4b5563; font-size: 12.5px; font-weight: 700;
|
||||
}
|
||||
/* 회의록 보드 — 파워포인트 색(#D24726)의 파스텔톤 */
|
||||
.pj-meet-board-btn {
|
||||
flex: none; align-self: center; gap: 4px;
|
||||
@@ -2847,6 +2855,33 @@ input.pj-meet-amount::placeholder { color: rgba(0, 0, 0, .28); }
|
||||
.pj-goal-wkpop-sum b { font-variant-numeric: tabular-nums; }
|
||||
.pj-goal-wkpop-acts { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
|
||||
|
||||
/* 나를 태그·작업 배정 알림 — 화면 가운데 아래 큰 팝업(body 에 붙음), 닫기 전까지 깜박인다(2026-10-07) */
|
||||
.pj-alert-pop {
|
||||
position: fixed; left: 50%; bottom: 28px; z-index: 1100; transform: translateX(-50%); width: min(560px, calc(100vw - 32px));
|
||||
max-height: 46vh; display: flex; flex-direction: column; background: #fff; border: 2px solid var(--pj-accent);
|
||||
border-radius: 16px; box-shadow: 0 18px 50px rgba(16, 24, 40, .28); overflow: hidden;
|
||||
animation: pj-alert-blink 1s ease-in-out infinite;
|
||||
}
|
||||
@keyframes pj-alert-blink {
|
||||
0%, 100% { border-color: var(--pj-accent); box-shadow: 0 18px 50px rgba(16, 24, 40, .28), 0 0 0 0 rgba(124, 92, 255, .55); }
|
||||
50% { border-color: #ff6b4a; box-shadow: 0 18px 50px rgba(16, 24, 40, .28), 0 0 0 10px rgba(255, 107, 74, .18); }
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) { .pj-alert-pop { animation: none; border-color: #ff6b4a; } }
|
||||
.pj-alert-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: #fff4f0; border-bottom: 1px solid #f6d6cc; }
|
||||
.pj-alert-head .material-symbols-outlined { color: #e5532f; font-size: 22px; }
|
||||
.pj-alert-head b { flex: 1 1 auto; font-size: 15px; }
|
||||
.pj-alert-list { overflow-y: auto; padding: 6px; }
|
||||
.pj-alert-item { display: flex; align-items: center; gap: 10px; padding: 10px 10px; border-radius: 10px; color: var(--pj-ink); text-decoration: none; }
|
||||
.pj-alert-item:hover { background: #f5f6f8; }
|
||||
.pj-alert-kind { flex: none; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
|
||||
.pj-alert-kind.is-mention { background: #eef2ff; color: #4053c8; }
|
||||
.pj-alert-kind.is-assigned { background: #e7f6ec; color: #1f8a4c; }
|
||||
.pj-alert-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
|
||||
.pj-alert-text b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.pj-alert-text small { color: var(--pj-ink-soft); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.pj-alert-go { flex: none; font-size: 12.5px; font-weight: 600; color: var(--pj-accent-dark); }
|
||||
@media print { .pj-alert-pop { display: none !important; } }
|
||||
|
||||
/* 영역 색 고르기 팝업(body 에 붙음) */
|
||||
.pj-goal-colorpop {
|
||||
position: fixed; z-index: 1000; display: grid; grid-template-columns: repeat(8, 26px); gap: 6px;
|
||||
|
||||
+120
-26
@@ -3709,9 +3709,8 @@
|
||||
const list = byGroup[gid];
|
||||
const grp = (groupBySession ? "S" : "P") + gid;
|
||||
const meta = groupBySession ? {} : (projById[gid] || {});
|
||||
// 행 색 — "이 프로젝트"는 섹션에 지정한 색(없으면 프로젝트 색), "전체 프로젝트"는 프로젝트 색
|
||||
const stageColor = groupBySession && stageById[gid] ? stageById[gid].color : null;
|
||||
const groupColor = stageColor || list[0].project_color || meta.color || "#4573d2";
|
||||
// 행 색 — 프로젝트 색(섹션별 색은 없앴다, 2026-10-07)
|
||||
const groupColor = list[0].project_color || meta.color || "#4573d2";
|
||||
const groupName = groupBySession
|
||||
? (gid === "none" ? "미지정" : (list[0].stage_name || "섹션"))
|
||||
: (list[0].project_name || meta.name || "프로젝트");
|
||||
@@ -4108,21 +4107,16 @@
|
||||
// "+ 세션 추가" 버튼은 보드(스크롤 영역) 밖 고정 위치에 있어 세션이
|
||||
// 늘어나 스크롤이 생겨도 항상 보인다 — 한 번만 wiring, 표시 여부만 매
|
||||
// 렌더마다 토글.
|
||||
// ── 세션 추가/편집 팝업 — 이름 + 색상(아사나 10색). "+ 세션 추가" 버튼과
|
||||
const STAGE_HEAD_BG = "#f3f3f3";
|
||||
// ── 섹션 추가/편집 팝업 — 이름 + 기본 담당자(색 지정은 없앰). "+ 세션 추가" 버튼과
|
||||
// 세션 헤더 ✎(세션 편집) 아이콘·컨텍스트 메뉴가 전부 이 모달 하나를 쓴다.
|
||||
const stageModal = el("pj-modal-stage");
|
||||
let getStageColor = null;
|
||||
if (stageModal) wireModalClose(stageModal);
|
||||
function openStageModal(stage) {
|
||||
if (!stageModal) return;
|
||||
el("pj-stage-modal-title").textContent = stage ? "\"" + stage.name + "\" 섹션 편집" : "새 섹션";
|
||||
el("pj-stg-id").value = stage ? stage.id : "";
|
||||
el("pj-stg-name").value = stage ? stage.name : "";
|
||||
// 프로젝트와 같은 색상표. 색이 없는 섹션은 첫 칸(연회색 = 색 없음)이 선택된 채로.
|
||||
const noColor = (window.PJ_STAGE_COLORS || [])[0];
|
||||
getStageColor = renderColorPalette(
|
||||
el("pj-stg-colors"), null, (stage && stage.color) || noColor, window.PJ_STAGE_COLORS
|
||||
);
|
||||
// 기본 담당자 후보 = 업무 담당자 후보와 같다(프로젝트 멤버 + owner).
|
||||
// 지금 지정된 사람이 멤버에서 빠졌어도 선택지에 남겨 칸이 비지 않게 한다.
|
||||
const cur = stage ? (stage.default_assignee_email || "") : "";
|
||||
@@ -4153,8 +4147,7 @@
|
||||
const id = el("pj-stg-id").value;
|
||||
const name = el("pj-stg-name").value.trim();
|
||||
if (!name) { alert("섹션 이름을 입력하세요."); return; }
|
||||
const color = getStageColor ? getStageColor() : null;
|
||||
const body = { name: name, color: color };
|
||||
const body = { name: name }; // 섹션 색은 보내지 않는다(화면은 늘 #f3f3f3)
|
||||
// 기본 담당자는 바뀐 경우에만 보낸다 — DB 마이그레이션 009 전이라도
|
||||
// 이름·색상 편집은 그대로 되게.
|
||||
const picker = el("pj-stg-assignee");
|
||||
@@ -4348,11 +4341,10 @@
|
||||
const col = document.createElement("div");
|
||||
col.className = "pj-col" + (s.is_done_stage ? " pj-col-done" : "");
|
||||
col.dataset.stageId = s.id;
|
||||
// 섹션 머리 색은 모두 같은 연회색(#f3f3f3) — 섹션별 색 지정은 2026-10-07 요청으로 없앴다(DB 의 예전 색은 쓰지 않는다)
|
||||
col.innerHTML =
|
||||
'<div class="pj-col-head' + (s.color ? " pj-col-head-colored" : "") +
|
||||
(s.color && isLightColor(s.color, 0.6, "#eef0f4") ? " is-light" : "") + '"' +
|
||||
(canManage ? ' draggable="true"' : "") +
|
||||
(s.color ? ' style="background:' + hexToRgba(s.color, 0.6) + '"' : "") + '>' +
|
||||
'<div class="pj-col-head pj-col-head-colored is-light"' +
|
||||
(canManage ? ' draggable="true"' : "") + ' style="background:' + STAGE_HEAD_BG + '">' +
|
||||
// 아사나처럼: 이름 바로 오른쪽에 업무 수(숫자만), 맨 오른쪽에 + / … 버튼.
|
||||
'<span class="pj-col-name">' + escapeHtml(s.name) + "</span>" +
|
||||
'<span class="pj-col-count"></span>' +
|
||||
@@ -10457,6 +10449,8 @@
|
||||
initMeetQuickTasks();
|
||||
const week = pane.dataset.week, year = pane.dataset.year;
|
||||
const isAdmin = pane.dataset.admin === "true";
|
||||
// 회의록은 누구나 고친다(2026-10-07) — 회의 완료(잠금)면 아무도 못 고친다(data-edit). 관리자만 삭제·완료·완료 해제.
|
||||
const canEdit = pane.dataset.edit === "true";
|
||||
const SCROLL_KEY = "pj_meet_scroll";
|
||||
function reloadKeepScroll() {
|
||||
try { sessionStorage.setItem(SCROLL_KEY, JSON.stringify([location.pathname + location.search, window.scrollY, pane.scrollTop])); } catch (_) {}
|
||||
@@ -10481,10 +10475,34 @@
|
||||
initMeetingSync(pane); // 보기만 하는 사람도(실적 권한이 있으면) 매출 자료 갱신
|
||||
const table = el("pj-meet-table");
|
||||
const cellGrid = table && window.PJMeetingCells ? window.PJMeetingCells.init({
|
||||
table: table, pane: pane, admin: isAdmin, api: api, confirm: confirm, toast: showToast,
|
||||
table: table, pane: pane, admin: canEdit, api: api, confirm: confirm, toast: showToast,
|
||||
menu: showContextMenu, icon: menuIcon, zoom: uiZoom,
|
||||
}) : null;
|
||||
if (!isAdmin) return;
|
||||
// 회의록 삭제·회의 완료·완료 해제 — 관리자(잠긴 회의록에서도 쓸 수 있게 편집 도구보다 먼저 연결)
|
||||
const del = el("pj-meet-del");
|
||||
if (del) del.addEventListener("click", async function () {
|
||||
const ok = await confirm("이 주 회의록을 삭제할까요? 줄·금액·메모가 모두 삭제되고, 다음 주 회의록의 '지난주' 칸도 비게 됩니다.",
|
||||
{ okText: "삭제", cancelText: "취소" });
|
||||
if (!ok) return;
|
||||
try { await api("DELETE", "/project/api/goals/meetings/" + week); location.reload(); }
|
||||
catch (e) { showToast("삭제 실패: " + e.message, "error"); }
|
||||
});
|
||||
[["pj-meet-complete", true], ["pj-meet-reopen", false]].forEach(function (pair) {
|
||||
const btn = el(pair[0]);
|
||||
if (!btn) return;
|
||||
btn.addEventListener("click", async function () {
|
||||
const done = pair[1];
|
||||
if (!(await confirm(done ? "회의를 완료할까요? 완료하면 이 회의록은 아무도 고칠 수 없습니다(관리자가 완료 해제 가능)."
|
||||
: "완료를 해제할까요? 다시 누구나 고칠 수 있습니다.", { okText: done ? "회의 완료" : "완료 해제", cancelText: "취소" }))) return;
|
||||
btn.disabled = true;
|
||||
try {
|
||||
if (done && canEdit) await flushAll(); // 쓰던 글을 먼저 저장(함수 선언 — 아래쪽 정의)
|
||||
await api("POST", "/project/api/goals/meetings/" + week + "/complete", { done: done });
|
||||
reloadKeepScroll();
|
||||
} catch (e) { btn.disabled = false; showToast((done ? "회의 완료" : "완료 해제") + " 실패: " + e.message, "error"); }
|
||||
});
|
||||
});
|
||||
if (!canEdit) return;
|
||||
|
||||
function flashSaved(node) {
|
||||
if (!node) return;
|
||||
@@ -10824,14 +10842,6 @@
|
||||
return true;
|
||||
});
|
||||
});
|
||||
const del = el("pj-meet-del");
|
||||
if (del) del.addEventListener("click", async function () {
|
||||
const ok = await confirm("이 주 회의록을 삭제할까요? 줄·금액·메모가 모두 삭제되고, 다음 주 회의록의 '지난주' 칸도 비게 됩니다.",
|
||||
{ okText: "삭제", cancelText: "취소" });
|
||||
if (!ok) return;
|
||||
try { await api("DELETE", meetingUrl); location.reload(); }
|
||||
catch (e) { showToast("삭제 실패: " + e.message, "error"); }
|
||||
});
|
||||
}
|
||||
|
||||
// ── 휴지통(관리자 전용 화면) — [복구] 누르면 원래 id 그대로 되살리고 줄을 지운다.
|
||||
@@ -10863,6 +10873,89 @@
|
||||
if (window.__PJ_TEST__) { // 자동 테스트 전용 — 순수 도우미
|
||||
window.__pjHelpers = { kstTodayIso: kstTodayIso, dueInfo: dueInfo, isImeEnter: isImeEnter };
|
||||
}
|
||||
// ── 나를 태그하거나 새 작업을 배정받으면 화면 가운데 아래 큰 팝업(2026-10-07) — 깜박여서 눈에 띄고, [닫기] 전까지 남는다.
|
||||
// 프로젝트 화면들이 20초마다(창을 다시 볼 때 바로) GET /project/api/notifications/alerts?after=본 것 을 확인한다.
|
||||
// 본 것 = localStorage pj_alert_seen:{이메일} — 처음이면 지금 최신 알림을 기준으로 삼아 옛 알림을 한꺼번에 띄우지 않는다.
|
||||
// 다른 탭에서 닫으면(storage 이벤트) 이 탭 팝업도 닫는다. 수신함 오른쪽 패널(iframe, html.pj-embed) 안에서는 돌지 않는다.
|
||||
function initTaskAlerts() {
|
||||
if (document.documentElement.classList.contains("pj-embed")) return;
|
||||
const POLL_MS = 20000;
|
||||
let me = "", pop = null, timer = 0, busy = false;
|
||||
const shown = new Map(); // id → 알림
|
||||
const seenKey = function () { return "pj_alert_seen:" + me; };
|
||||
const readSeen = function () { try { const v = localStorage.getItem(seenKey()); return v == null ? null : Number(v); } catch (_) { return null; } };
|
||||
const writeSeen = function (v) { try { localStorage.setItem(seenKey(), String(v)); } catch (_) {} };
|
||||
function schedule() { clearTimeout(timer); timer = setTimeout(poll, POLL_MS); }
|
||||
async function poll() {
|
||||
if (busy) return;
|
||||
if (document.hidden) { schedule(); return; }
|
||||
busy = true;
|
||||
try {
|
||||
let after = me ? readSeen() : null;
|
||||
let res = await api("GET", "/project/api/notifications/alerts" + (after == null ? "" : "?after=" + after));
|
||||
if (res && res.me && !me) {
|
||||
me = res.me;
|
||||
after = readSeen();
|
||||
if (after == null) writeSeen(res.latest_id || 0); // 처음 — 지금까지 온 알림은 띄우지 않는다
|
||||
else if (after < (res.latest_id || 0)) res = await api("GET", "/project/api/notifications/alerts?after=" + after);
|
||||
}
|
||||
((res && res.alerts) || []).forEach(function (n) { if (!shown.has(n.id)) shown.set(n.id, n); });
|
||||
if (shown.size) render();
|
||||
} catch (_) {
|
||||
// 알림 확인 실패는 조용히 — 다음 주기에 다시
|
||||
} finally {
|
||||
busy = false;
|
||||
schedule();
|
||||
}
|
||||
}
|
||||
function close() {
|
||||
if (!pop) return;
|
||||
const maxId = Math.max.apply(null, Array.from(shown.keys()).concat([readSeen() || 0]));
|
||||
writeSeen(maxId);
|
||||
shown.clear();
|
||||
pop.remove();
|
||||
pop = null;
|
||||
}
|
||||
function render() {
|
||||
if (!pop) {
|
||||
pop = document.createElement("div");
|
||||
pop.className = "pj-alert-pop";
|
||||
pop.setAttribute("role", "alertdialog");
|
||||
pop.setAttribute("aria-live", "assertive");
|
||||
document.body.appendChild(pop); // 배율(.pj-ui-scale) 밖 — body 에
|
||||
pop.addEventListener("click", function (e) {
|
||||
if (e.target.closest("[data-alert-close]")) close();
|
||||
const open = e.target.closest("[data-alert-open]");
|
||||
if (open) {
|
||||
const id = open.dataset.alertOpen;
|
||||
fetch("/project/api/notifications/" + id + "/read", { method: "POST" }).catch(function () {});
|
||||
}
|
||||
});
|
||||
}
|
||||
const items = Array.from(shown.values());
|
||||
pop.innerHTML = '<div class="pj-alert-head"><span class="material-symbols-outlined">notifications_active</span>' +
|
||||
"<b>새 알림 " + items.length + "건</b>" +
|
||||
'<button type="button" class="pj-btn pj-btn-sm" data-alert-close>닫기</button></div>' +
|
||||
'<div class="pj-alert-list">' + items.map(function (n) {
|
||||
const isMention = n.type === "mention";
|
||||
const href = n.project_id ? "/project/p/" + n.project_id + (n.task_id ? "?task=" + n.task_id : "") : "/project/inbox";
|
||||
return '<a class="pj-alert-item" href="' + escapeHtml(href) + '" data-alert-open="' + escapeHtml(n.id) + '">' +
|
||||
'<span class="pj-alert-kind ' + (isMention ? "is-mention" : "is-assigned") + '">' +
|
||||
(isMention ? "나를 태그" : "작업 배정") + "</span>" +
|
||||
'<span class="pj-alert-text"><b>' + escapeHtml(String(n.title || "").replace(/^(나를 태그함|작업 배정):\s*/, "")) + "</b>" +
|
||||
"<small>" + escapeHtml((n.body || "") + (n.actor_email ? " · " + capName(idOf(n.actor_email)) : "")) + "</small></span>" +
|
||||
'<span class="pj-alert-go">열기 ›</span></a>';
|
||||
}).join("") + "</div>";
|
||||
}
|
||||
window.addEventListener("storage", function (e) {
|
||||
if (!pop || !me || e.key !== seenKey()) return;
|
||||
const v = Number(e.newValue || 0);
|
||||
if (Array.from(shown.keys()).every(function (id) { return id <= v; })) { shown.clear(); pop.remove(); pop = null; }
|
||||
});
|
||||
document.addEventListener("visibilitychange", function () { if (!document.hidden) poll(); });
|
||||
poll();
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
// 좌측 프로젝트 목록 — 프로젝트 화면은 initProject 가 자기 데이터로 직접 연다.
|
||||
if (!document.querySelector(".pj-project-view")) initSideTree();
|
||||
@@ -10875,6 +10968,7 @@
|
||||
initAllMembers();
|
||||
initBell();
|
||||
initMentionBadge();
|
||||
initTaskAlerts();
|
||||
initInbox();
|
||||
initInboxTaskPanel();
|
||||
initMentionInbox();
|
||||
|
||||
@@ -125,6 +125,17 @@ docker exec postgres-db psql -U postgres -d project_db -c "SELECT to_regclass('g
|
||||
|
||||
설정이 없거나 권한이 모자라면 버튼을 눌렀을 때 사유가 안내되고(503), 회의록 다른 기능은 그대로 동작한다.
|
||||
|
||||
## 주간 회의록 회의 완료 마이그레이션 (022)
|
||||
|
||||
022는 `goal_meetings` 에 `completed_at`·`completed_by` 열만 추가한다(기존 값 그대로, 다시 실행 가능). 미적용이면 [회의 완료] 버튼이 나오지 않고
|
||||
회의록은 누구나 계속 고칠 수 있다.
|
||||
|
||||
```bash
|
||||
cd /opt/www/main
|
||||
docker exec postgres-db pg_dump -U postgres project_db > ~/project_db_before_022_$(date +%Y%m%d%H%M).sql
|
||||
docker exec -i postgres-db psql -v ON_ERROR_STOP=1 -U postgres -d project_db < scripts/sql/project_db_022_meeting_complete.sql
|
||||
```
|
||||
|
||||
## 주간 회의록 정량 목표·결과 글 마이그레이션 (021)
|
||||
|
||||
021은 `goal_meeting_items` 에 `target_text`·`result_text` 열만 추가한다(기존 값 그대로, 다시 실행 가능). 미적용이면 정량 목표·결과는 예전처럼 숫자만 받는다.
|
||||
|
||||
@@ -372,6 +372,9 @@ docker exec -i postgres-db psql -v ON_ERROR_STOP=1 -U postgres -d project_db \
|
||||
# 020 = 새 주차(월요일 아닌 시작일)·지난주 결과 글·주차별 매출 목표 + 흡수된 월요일 회의록 이동 — 적용 전 project_db 백업(6-9-4)
|
||||
docker exec -i postgres-db psql -v ON_ERROR_STOP=1 -U postgres -d project_db \
|
||||
< scripts/sql/project_db_020_meeting_periods.sql
|
||||
# 022 = 회의 완료(goal_meetings.completed_at·completed_by) — 열 추가만(6-9-4)
|
||||
docker exec -i postgres-db psql -v ON_ERROR_STOP=1 -U postgres -d project_db \
|
||||
< scripts/sql/project_db_022_meeting_complete.sql
|
||||
# 021 = 회의록 정량 목표·결과에 글(target_text·result_text, 예: 20개) — 열 추가만(6-9-4)
|
||||
docker exec -i postgres-db psql -v ON_ERROR_STOP=1 -U postgres -d project_db \
|
||||
< scripts/sql/project_db_021_meeting_amount_text.sql
|
||||
@@ -895,6 +898,18 @@ description 을 항상 HTML로 취급하기 때문). 두 번 실행하면 이중
|
||||
이름 `{월}월 {n}주차 ({기간})`(`router.meeting_board_title`), 첫 장의 제목·부제목 틀(TITLE 레이아웃)을 지우고 틀 없는 BLANK 한 장만.
|
||||
파일 이름을 바꿔도 같은 보드, 휴지통에 버리면 다음에 새로 만든다. 인증은 Google 시트 설정 재사용 + Drive·Slides 범위
|
||||
(`GOOGLE_SLIDES_OAUTH_REFRESH_TOKEN` 없으면 시트 토큰 — Drive·Slides 권한으로 재발급 필요, docs/DEPLOYMENT.md). DB 변경 없음.
|
||||
- **회의록 누구나 수정 · 회의 완료 잠금**(마이그레이션 022, 2026-10-07): 회의록 만들기·머리 칸·줄 추가/삭제/이동·셀 이동/병합·줄 칸 API 가
|
||||
`_require_admin` → `_require_user`(프로젝트 권한자 누구나). 회의록 삭제와 `POST /api/goals/meetings/{주차}/complete {done}`(회의 완료·완료 해제)만
|
||||
관리자. `goal_meetings.completed_at`·`completed_by` 가 있으면 잠금 — `db._check_meeting_open`(머리 칸·줄 추가·`_locked_meeting_items`)이
|
||||
`store.MeetingLocked` → 409. 예외: 줄 칸 변경이 결과(`result_note`·`result_amount`·`status`)뿐이면 그 줄의 회의록이 아니라 **바로 다음 주차
|
||||
회의록**(그 결과를 적는 회의)의 잠금을 본다. 화면은 `data-edit`(완료 전이면 누구나) 로 편집 도구를 켜고, 관리자에게 [회의 완료]/[완료 해제],
|
||||
완료면 "🔒 회의 완료" 표시. 022 전이면 완료 버튼 없음(`meeting.can_complete`).
|
||||
- **알림 팝업**(2026-10-07): 나를 태그(mention)하거나 작업을 배정(assigned)받으면 프로젝트 화면 가운데 아래에 깜박이는 큰 팝업(`initTaskAlerts`,
|
||||
`.pj-alert-pop`, body 에 붙음) — [닫기] 전까지 남는다. 20초마다(창을 다시 볼 때 바로) `GET /api/notifications/alerts?after=본 것`(읽지 않은
|
||||
mention·assigned 중 after 보다 새 것, 지금 볼 수 있는 작업만, 오래된 것부터 10). 본 것 = localStorage `pj_alert_seen:{이메일}`, 처음 쓰는 브라우저는
|
||||
latest_id 를 기준으로 삼아 옛 알림을 한꺼번에 띄우지 않는다. 다른 탭에서 닫으면 storage 이벤트로 함께 닫힌다. 수신함 iframe 안에선 돌지 않는다.
|
||||
- **섹션 색 없앰**(2026-10-07): 보드 섹션 머리는 모두 `#f3f3f3`(`STAGE_HEAD_BG`), 섹션 편집 창의 색 고르기 삭제(저장 때 color 를 보내지 않는다),
|
||||
타임라인 줄 색은 프로젝트 색. DB 의 `project_stages.color` 값은 남아 있지만 화면에서 쓰지 않는다.
|
||||
- **정량 목표·결과(금액)에 글**(마이그레이션 021, 2026-10-07): 입력이 숫자로 읽히면(`store.validate_meeting_amount` — 1,200,000 · 120만 ·
|
||||
1.5억) 지금처럼 `target_amount`/`result_amount`(원 정수), 아니면(예: "20개", 100자까지) `target_text`/`result_text` 에 — 둘 중 하나만
|
||||
채운다(숫자로 바꾸면 글은 비움). 화면·전주 목표는 글이 있으면 글, 없으면 쉼표 숫자. 021 전이면 글은 예전처럼 400(숫자 오류).
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
-- =====================================================================
|
||||
-- project_db 마이그레이션 022 — 주간 회의록 "회의 완료"(수정 잠금)
|
||||
-- =====================================================================
|
||||
-- 멱등(idempotent). 열만 추가한다(기존 값 변경·삭제 없음). 운영: /opt/www/main 에서 기존 project_db 에 적용.
|
||||
--
|
||||
-- 왜(2026-10-07 사용자 요청): 주간 회의록은 프로젝트 권한이 있는 누구나 고칠 수 있고, 관리자가 [회의 완료]를 누르면
|
||||
-- 그 회의록은 더 고칠 수 없다(관리자는 [완료 해제]로 다시 열 수 있다).
|
||||
-- completed_at 이 있으면 완료. 지난주 결과(글·금액)는 다음 주 회의록이 열려 있는 동안만 고칠 수 있다.
|
||||
-- =====================================================================
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE goal_meetings ADD COLUMN IF NOT EXISTS completed_at TIMESTAMPTZ NULL;
|
||||
ALTER TABLE goal_meetings ADD COLUMN IF NOT EXISTS completed_by TEXT NOT NULL DEFAULT '';
|
||||
COMMENT ON COLUMN goal_meetings.completed_at IS '회의 완료 시각 — 있으면 이 회의록은 수정 잠금(관리자만 완료·해제)';
|
||||
COMMENT ON COLUMN goal_meetings.completed_by IS '회의 완료를 누른 관리자 이메일';
|
||||
|
||||
COMMIT;
|
||||
SELECT 'project_db 022 meeting complete ready' AS status;
|
||||
@@ -15,7 +15,7 @@ const ROOT = path.join(__dirname, "..", "..");
|
||||
const OUT = path.join(__dirname, ".out");
|
||||
const JS = fs.readFileSync(path.join(ROOT, "app", "static", "project.js"), "utf8");
|
||||
const PAGE = {};
|
||||
["goals_admin", "goals_ro", "goals_weekly_admin", "meeting_admin", "meeting_err", "meeting_ro"].forEach(function (n) {
|
||||
["goals_admin", "goals_ro", "goals_weekly_admin", "meeting_admin", "meeting_err", "meeting_ro", "meeting_member"].forEach(function (n) {
|
||||
PAGE[n] = fs.readFileSync(path.join(OUT, n + ".html"), "utf8");
|
||||
});
|
||||
const GOALS_URL = "http://localhost/project/goals/2026";
|
||||
@@ -532,6 +532,31 @@ function meetServer(env, st) {
|
||||
check("[2g] 적용 전 줄 × → 줄만 지움", d.querySelectorAll("#pj-meet-quick tbody tr").length === n - 1 && env.calls.length === calls);
|
||||
}, { notifyOnFail: true });
|
||||
|
||||
// ════════════════════ [2h] 회의록은 누구나 수정 · [회의 완료](관리자)면 잠금 ════════════════════
|
||||
await section(async function () {
|
||||
const env = makeEnv(PAGE.meeting_member, MEET_URL);
|
||||
const st = meetServer(env);
|
||||
await boot(env);
|
||||
const d = env.d;
|
||||
check("[2h] 직원도 회의록 입력칸·메모 편집", !!d.querySelector(".pj-meet-text") && !!d.getElementById("pj-meet-notes"));
|
||||
check("[2h] 직원에겐 삭제·회의 완료 버튼 없음", !d.getElementById("pj-meet-del") && !d.getElementById("pj-meet-complete"));
|
||||
const ta = d.querySelector('tr[data-item="1"] .pj-meet-text');
|
||||
ta.focus(); type(env, ta, "직원이 적은 업무"); ta.blur(); await settle(); await wait(10); await settle();
|
||||
check("[2h] 직원 입력 저장", st.items[1] && st.items[1].content === "직원이 적은 업무", st.items[1]);
|
||||
});
|
||||
await section(async function () {
|
||||
const env = makeEnv(PAGE.meeting_admin, MEET_URL);
|
||||
meetServer(env);
|
||||
let posted = null;
|
||||
env.route("POST", /\/project\/api\/goals\/meetings\/2026-09-28\/complete$/, function (u, body) { posted = body; return { body: { ok: true, completed: true } }; });
|
||||
env.w.erpConfirm = function () { return Promise.resolve(true); };
|
||||
await boot(env);
|
||||
env.d.getElementById("pj-meet-complete").click(); await settle(); await wait(10); await settle();
|
||||
check("[2h] 관리자 [회의 완료] → 완료 요청·새로고침", posted && posted.done === true && env.navigations === 1, [posted, env.navigations]);
|
||||
const ro = makeEnv(PAGE.meeting_ro, MEET_URL); meetServer(ro); await boot(ro);
|
||||
check("[2h] 완료된 회의록 — 입력칸 없음·완료 표시", !ro.d.querySelector(".pj-meet-text, #pj-meet-notes") && /회의 완료/.test(ro.d.querySelector(".pj-meet-done-badge").textContent));
|
||||
});
|
||||
|
||||
// ════════════════════ [3] 목표 표 — 글 저장 실패면 구조 변경·표 교체 중단 ════════════════════
|
||||
await section(async function () {
|
||||
const env = makeEnv(PAGE.goals_admin, GOALS_URL, { promptAnswer: "새 영역" });
|
||||
|
||||
@@ -727,6 +727,32 @@ function titleVal(d) { return d.getElementById("pj-t-title").value; }
|
||||
check("[대시보드 담당자별] 항목 → 작업 편집 창(하위 작업은 서버에서 받아)", !env.d.getElementById("pj-modal-task").hidden &&
|
||||
env.d.getElementById("pj-t-title").value === "하위 2", env.d.getElementById("pj-t-title").value);
|
||||
}
|
||||
// ── 나를 태그·작업 배정 알림 팝업 — 본 것 이후 새 알림만, 깜박이는 팝업, 닫기 전까지 유지 ──
|
||||
{
|
||||
const env = makeEnv(); baseRoutes(env);
|
||||
const asked = [];
|
||||
env.route("GET", /\/project\/api\/notifications\/alerts/, function (u) {
|
||||
asked.push(u);
|
||||
const after = /after=(\d+)/.exec(u);
|
||||
if (!after) return { body: { me: "me@test.local", latest_id: 5, alerts: [] } };
|
||||
return { body: { me: "me@test.local", latest_id: 5, alerts: [
|
||||
{ id: 4, type: "assigned", title: "작업 배정: 촬영 준비", body: "P1 · 마감 -", task_id: 101, project_id: 1, actor_email: "bob@test.local" },
|
||||
{ id: 5, type: "mention", title: "나를 태그함: 작업 A", body: "P1 · 댓글", task_id: 101, project_id: 1, actor_email: "bob@test.local" }] } };
|
||||
});
|
||||
env.w.localStorage.setItem("pj_alert_seen:me@test.local", "3");
|
||||
await boot(env); await settle(); await wait(10); await settle();
|
||||
const pop = env.d.body.querySelector(".pj-alert-pop");
|
||||
check("[알림 팝업] 본 것(3) 이후 새 알림 2건을 body 에 팝업", !!pop && pop.querySelectorAll(".pj-alert-item").length === 2 &&
|
||||
/촬영 준비/.test(pop.textContent) && /나를 태그/.test(pop.textContent) && asked.some(function (u) { return /after=3/.test(u); }), asked);
|
||||
pop.querySelector("[data-alert-close]").click();
|
||||
check("[알림 팝업] 닫기 → 사라지고 본 것 = 5", !env.d.body.querySelector(".pj-alert-pop") && env.w.localStorage.getItem("pj_alert_seen:me@test.local") === "5");
|
||||
}
|
||||
{
|
||||
const env = makeEnv(); baseRoutes(env);
|
||||
env.route("GET", /\/project\/api\/notifications\/alerts/, function () { return { body: { me: "me@test.local", latest_id: 9, alerts: [] } }; });
|
||||
await boot(env); await settle();
|
||||
check("[알림 팝업] 처음 쓰는 브라우저 — 옛 알림 안 띄우고 기준점만", !env.d.body.querySelector(".pj-alert-pop") && env.w.localStorage.getItem("pj_alert_seen:me@test.local") === "9");
|
||||
}
|
||||
// ── 멤버 배정·제외 — 지금 멤버는 체크된 채로, 체크 = 배정 · 해제 = 제외(확인 뒤) ──
|
||||
{
|
||||
const env = makeEnv(adminHtml); baseRoutes(env);
|
||||
|
||||
@@ -103,7 +103,7 @@ def meeting_view(err: bool) -> dict:
|
||||
|
||||
def meeting_ctx(admin: bool, err: bool, can_sync: bool = True) -> dict:
|
||||
view = meeting_view(err)
|
||||
return {
|
||||
ctx = {
|
||||
"user": {"email": ME, "is_super_admin": False}, "is_admin": admin, "nav_projects": [], "goal_years": [2026],
|
||||
"goal_year_active": 2026, "my_open_total": 0, "mention_unread": 0, "color_palette": ["#4573d2"],
|
||||
"project_icons": ["folder"], "goal_year": 2026, "goal_month": 9, "meetings_enabled": True,
|
||||
@@ -114,6 +114,16 @@ def meeting_ctx(admin: bool, err: bool, can_sync: bool = True) -> dict:
|
||||
"can_sync": can_sync, "meeting_status": store.MEETING_STATUS, "meet_members": [], "month_plan": None,
|
||||
"attendee_list": [], **copy.deepcopy(view),
|
||||
}
|
||||
# 회의록은 누구나 고친다(2026-10-07) — 보기 전용은 "회의 완료"된 회의록뿐. 관리자 아닌 화면 = 완료된 회의록으로 시험
|
||||
ctx["meeting"].update(can_complete=True, completed=not admin, completed_at="2026-10-02 18:00" if not admin else "",
|
||||
completed_by="admin@test.local" if not admin else "")
|
||||
return ctx
|
||||
|
||||
|
||||
def member_ctx() -> dict:
|
||||
ctx = meeting_ctx(False, False, can_sync=False)
|
||||
ctx["meeting"].update(completed=False, completed_at="", completed_by="")
|
||||
return ctx
|
||||
|
||||
|
||||
def meeting_layout_ctx(admin: bool) -> dict:
|
||||
@@ -156,6 +166,8 @@ def main() -> None:
|
||||
"meeting_admin.html": ("project/goal_meeting.html", meeting_ctx(True, False)),
|
||||
"meeting_err.html": ("project/goal_meeting.html", meeting_ctx(True, True)),
|
||||
"meeting_ro.html": ("project/goal_meeting.html", meeting_ctx(False, False, can_sync=False)),
|
||||
# 관리자 아닌 직원 + 아직 완료 전 회의록 — 누구나 고친다(2026-10-07)
|
||||
"meeting_member.html": ("project/goal_meeting.html", member_ctx()),
|
||||
"meeting_layout_admin.html": ("project/goal_meeting.html", meeting_layout_ctx(True)),
|
||||
"meeting_layout_ro.html": ("project/goal_meeting.html", meeting_layout_ctx(False)),
|
||||
"meeting_merged.html": ("project/goal_meeting.html", meeting_merged_ctx()),
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
"""알림 팝업 API — 기준점·태그/배정만·읽지 않은 것·after 이후·오래된 것부터. DB 없이 가짜 저장소로."""
|
||||
import importlib
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
api = importlib.import_module("app.modules.project.router")
|
||||
|
||||
ROWS = [ # 최신순(list_notifications 와 같게)
|
||||
{"id": 9, "type": "completed", "title": "완료", "is_read": False, "task_id": 1, "project_id": 1},
|
||||
{"id": 8, "type": "mention", "title": "나를 태그함: A", "is_read": False, "task_id": 1, "project_id": 1},
|
||||
{"id": 7, "type": "assigned", "title": "작업 배정: B", "is_read": True, "task_id": 2, "project_id": 1},
|
||||
{"id": 6, "type": "assigned", "title": "작업 배정: C", "is_read": False, "task_id": 3, "project_id": 1},
|
||||
{"id": 2, "type": "assigned", "title": "작업 배정: 옛것", "is_read": False, "task_id": 4, "project_id": 1},
|
||||
]
|
||||
|
||||
|
||||
class FakeStore:
|
||||
def list_notifications(self, recipient_email, unread_only=False, limit=100):
|
||||
rows = [r for r in ROWS if not unread_only or not r["is_read"]]
|
||||
return rows[:limit]
|
||||
|
||||
|
||||
class AlertsApiTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
app = FastAPI()
|
||||
app.include_router(api.router)
|
||||
self.client = TestClient(app)
|
||||
|
||||
def get(self, qs=""):
|
||||
with patch.object(api, "_require_user", return_value={"email": "Me@Test.local"}), \
|
||||
patch.object(api, "_db_or_503", return_value=FakeStore()), \
|
||||
patch.object(api, "_visible_notifications", side_effect=lambda st, user, items: items):
|
||||
return self.client.get("/project/api/notifications/alerts" + qs).json()
|
||||
|
||||
def test_without_after_returns_only_baseline(self):
|
||||
out = self.get()
|
||||
self.assertEqual((out["me"], out["latest_id"], out["alerts"]), ("me@test.local", 9, []))
|
||||
|
||||
def test_after_returns_unread_mentions_and_assignments_oldest_first(self):
|
||||
out = self.get("?after=5")
|
||||
self.assertEqual([a["id"] for a in out["alerts"]], [6, 8]) # 완료 알림(9)·읽은 것(7)·옛것(2) 제외
|
||||
self.assertEqual(out["alerts"][1]["type"], "mention")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -196,9 +196,6 @@ class MeetingCellTests(unittest.TestCase):
|
||||
endpoints = [("POST", "/meeting-cells/move", self.payload),
|
||||
("POST", "/meeting-cells/merge", dict(item_from=1, item_to=2)),
|
||||
("DELETE", "/meeting-items/1/cell-merge", None)]
|
||||
with patch.object(api, "_require_user", return_value=dict(role="user", email="user@test.local")):
|
||||
for method, endpoint, body in endpoints:
|
||||
self.assertEqual(client.request(method, "/project/api/goals" + endpoint, json=body).status_code, 403)
|
||||
with patch.object(api, "_require_user", return_value=dict(role="admin", email="admin@test.local")):
|
||||
url = "/project/api/goals/meeting-cells/move"
|
||||
self.assertEqual(client.post(url, json={}).status_code, 400)
|
||||
@@ -207,6 +204,10 @@ class MeetingCellTests(unittest.TestCase):
|
||||
self.st._meeting_cells = lambda conn: False
|
||||
self.assertEqual(client.post("/project/api/goals/meeting-cells/merge", json=dict(item_from=1, item_to=2)).status_code, 503)
|
||||
self.assertEqual(client.post(url, json=self.payload).status_code, 200, "Move/formatting work without 019")
|
||||
# 회의록은 누구나 고친다(2026-10-07) — 관리자가 아니어도 셀 이동·병합·해제를 막지 않는다(잠금은 회의 완료로)
|
||||
with patch.object(api, "_require_user", return_value=dict(role="user", email="user@test.local")):
|
||||
for method, endpoint, body in endpoints:
|
||||
self.assertNotEqual(client.request(method, "/project/api/goals" + endpoint, json=body).status_code, 403)
|
||||
|
||||
def test_amount_cells_accept_text_after_021_and_result_note_reaches_store(self):
|
||||
"""정량 목표·결과 — 숫자면 원 정수 칸, 글(예: 20개)이면 글 칸(021). 지난주 결과 글(result_note, 020)은 API 를 거쳐 저장된다."""
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
"""주간 회의록 — 누구나 수정, 회의 완료(022)면 잠금. 지난주 결과는 다음 주 회의록이 열려 있는 동안만. DB 없이."""
|
||||
import importlib
|
||||
import unittest
|
||||
from contextlib import contextmanager
|
||||
from datetime import date
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import patch
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app.modules.project import store
|
||||
from app.modules.project.db import ProjectStore
|
||||
from tests.test_project_meeting_cells import Connection
|
||||
|
||||
api = importlib.import_module("app.modules.project.router")
|
||||
|
||||
|
||||
class LockConnection(Connection):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.completed = set() # 완료된 주차 시작일
|
||||
|
||||
def execute(self, sql, params=()):
|
||||
if sql.startswith("SELECT completed_at FROM goal_meetings WHERE week_start = %s"):
|
||||
from tests.test_project_meeting_cells import Result
|
||||
return Result([{"completed_at": "done" if params[0] in self.completed else None}])
|
||||
return super().execute(sql, params)
|
||||
|
||||
|
||||
class MeetingLockTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.conn = LockConnection()
|
||||
|
||||
@contextmanager
|
||||
def connection():
|
||||
yield self.conn
|
||||
|
||||
self.st = ProjectStore.__new__(ProjectStore)
|
||||
self.st._pool = SimpleNamespace(connection=connection)
|
||||
self.st._table_exists = lambda conn, name: True
|
||||
self.st._column_exists = lambda conn, table, col: col in {"content_row_span", "completed_at", "result_note"}
|
||||
for r in self.conn.rows.values():
|
||||
r["result_note"] = ""
|
||||
|
||||
def test_completed_meeting_rejects_edits(self):
|
||||
self.conn.completed.add(date(2026, 9, 28))
|
||||
with self.assertRaises(store.MeetingLocked):
|
||||
self.st.update_meeting_item(item_id=1, fields={"content": "x"})
|
||||
with self.assertRaises(store.MeetingLocked):
|
||||
self.st.move_meeting_item(item_id=2, direction=1)
|
||||
|
||||
def test_last_week_result_follows_next_meeting(self):
|
||||
# 9/28 주차(9/28~9/30)가 완료돼도 다음 주차(10/1) 회의록이 열려 있으면 결과는 적을 수 있다
|
||||
self.conn.completed.add(date(2026, 9, 28))
|
||||
out = self.st.update_meeting_item(item_id=1, fields={"result_note": "잘 됨", "result_amount": "100"})
|
||||
self.assertEqual((out["result_note"], out["result_amount"]), ("잘 됨", 100))
|
||||
self.conn.completed.add(date(2026, 10, 1))
|
||||
with self.assertRaises(store.MeetingLocked):
|
||||
self.st.update_meeting_item(item_id=1, fields={"result_note": "늦게"})
|
||||
|
||||
def test_anyone_edits_but_only_admin_completes(self):
|
||||
app = FastAPI()
|
||||
app.include_router(api.router)
|
||||
app.state.project_store = self.st
|
||||
client = TestClient(app)
|
||||
member = dict(role="user", email="member@test.local")
|
||||
with patch.object(api, "_require_user", return_value=member):
|
||||
r = client.put("/project/api/goals/meeting-items/1", json={"content": "누구나"})
|
||||
self.assertEqual(r.status_code, 200, r.text)
|
||||
self.assertEqual(client.post("/project/api/goals/meetings/2026-09-28/complete", json={"done": True}).status_code, 403)
|
||||
self.conn.completed.add(date(2026, 9, 28))
|
||||
r = client.put("/project/api/goals/meeting-items/1", json={"content": "잠김"})
|
||||
self.assertEqual(r.status_code, 409, r.text)
|
||||
self.assertIn("회의가 완료", r.json()["detail"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -747,7 +747,8 @@ def test_goal_meetings():
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
assert req("POST", f"/project/api/goals/meetings/{w1}", BOB, json={"year": w1.year}).status_code == 403
|
||||
# 회의 완료(잠금)는 관리자만 — 회의록 만들기·고치기는 누구나(2026-10-07)
|
||||
assert req("POST", f"/project/api/goals/meetings/{w1}/complete", BOB, json={"done": True}).status_code == 403
|
||||
assert req("POST", f"/project/api/goals/meetings/{w1 + timedelta(days=1)}", ADMIN, json={}).status_code == 400
|
||||
r = req("POST", f"/project/api/goals/meetings/{w1}", ADMIN, json={"year": w1.year})
|
||||
assert r.status_code == 201 and r.json()["created"] is True, r.text
|
||||
@@ -771,7 +772,7 @@ def test_goal_meetings():
|
||||
assert r.status_code == 400
|
||||
assert put(coupang["id"], {"target_amount": "1,200만"}).json()["item"]["target_amount"] == 12_000_000
|
||||
assert put(coupang["id"], {"status": "bogus"}).status_code == 400
|
||||
assert put(coupang["id"], {"content": "x"}, BOB).status_code == 403
|
||||
assert put(coupang["id"], {"content": "추석 타임딜"}, BOB).status_code == 200 # 누구나 수정
|
||||
assert req("PUT", f"/project/api/goals/meetings/{w1}", ADMIN,
|
||||
json={"week_target": "3천만", "attendees": "대표", "notes": "메모"}).status_code == 200
|
||||
# 다음 주 — 줄을 이어받고 전주 칸(prev)에 지난주 할 일·목표
|
||||
@@ -781,6 +782,14 @@ def test_goal_meetings():
|
||||
c2 = next(it for it in m2["items"] if it["carry_from"] == coupang["id"])
|
||||
assert c2["prev"]["content"] == "추석 타임딜" and c2["prev"]["target_amount"] == 12_000_000
|
||||
assert m2["prev_meeting"] == {"week_start": w1.isoformat(), "week_target": 30_000_000}
|
||||
# 회의 완료(022) — w1 을 잠그면 w1 의 주요 업무는 못 고치지만, 지난주 결과는 다음 주(w2)가 열려 있으니 적을 수 있다
|
||||
r = req("POST", f"/project/api/goals/meetings/{w1}/complete", ADMIN, json={"done": True})
|
||||
if r.status_code == 200:
|
||||
assert put(coupang["id"], {"content": "잠김"}, BOB).status_code == 409
|
||||
assert put(coupang["id"], {"result_amount": "100"}, BOB).status_code == 200
|
||||
assert req("POST", f"/project/api/goals/meetings/{w1}/complete", ADMIN, json={"done": False}).json()["completed"] is False
|
||||
else:
|
||||
assert r.status_code == 503, r.text # 022 미적용
|
||||
# 지난주 결과·평가는 지난 회의록 줄에 저장
|
||||
assert put(coupang["id"], {"result_amount": "1.5억", "status": "done"}).json()["item"]["result_amount"] == 150_000_000
|
||||
# 줄 추가(기준 줄 아래)·이동(같은 구역 안)·삭제, 새 구역
|
||||
|
||||
Reference in New Issue
Block a user