diff --git a/app/modules/cupang/templates/cupang/index.html b/app/modules/cupang/templates/cupang/index.html
index 6b3a1ee..171dfb9 100644
--- a/app/modules/cupang/templates/cupang/index.html
+++ b/app/modules/cupang/templates/cupang/index.html
@@ -2,7 +2,7 @@
{% block head_extra %}
{# 출고리스트 작성 팝업의 날짜 칸은 프로젝트 화면의 날짜 팝업을 그대로 쓴다 — project.js 는 PJ_LIB_ONLY 로 부품만 #}
-
+
@@ -249,7 +249,7 @@
{% endblock %}
{% block scripts %}
-
+
{% endblock %}
@@ -64,7 +64,7 @@
-
+
{% endif %}
{% endblock %}
diff --git a/app/modules/project/CLAUDE.md b/app/modules/project/CLAUDE.md
index be83feb..bc77f0e 100644
--- a/app/modules/project/CLAUDE.md
+++ b/app/modules/project/CLAUDE.md
@@ -96,6 +96,13 @@
## 알림
+- **매일 하는 업무**(2026-11-11, 마이그레이션 033 `tasks.repeat_daily`) — 날짜 팝업 `openDatePopover({allowDaily, daily})` 아래 [매일](repeat 아이콘) =
+ `{due_date: null, repeat_daily: true}`(서버 `db.update_task` 가 마감일·시각 비움, 마감일을 고르면 자동으로 꺼짐). 업무 행에 `repeat_daily` 키가 있을 때만(=033 적용) 버튼이 보인다.
+ 카드·목록·내 업무·세부 업무·업무 창 마감 칸 = `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.
+
- 수신함은 확인 안 한 태그·읽지 않은 알림만(2026-10-08) — [확인] 버튼 없이 줄을 누르면 읽음·확인 처리(같은 작업 줄 함께) + 페이지 이동 없이 오른쪽 iframe 패널, 다른 줄을 고르거나 패널을 닫으면 그 줄은 목록에서 빠짐.
- 나를 태그하거나 작업이 배정되면 프로젝트 화면 가운데 아래에 깜박이는 큰 팝업(닫기 전까지, `initTaskAlerts` + `GET /api/notifications/alerts`).
- **마감 지난 내 업무 위쪽 알림**(`static/erp-overdue.js`, ERP 모든 화면, `GET /project/api/my-overdue`, 닫으면 1시간 뒤 다시 — 새로 지난 업무는 바로)(6-17).
@@ -115,6 +122,7 @@
- **"전체 보기" 메뉴를 볼 사람**(2026-11-11) = 프로젝트 화면 분류에 처음 여는 탭과 묶음. 옵션 키 `all_view_users`(이메일 목록, DB 변경 없음 — 029 키·값 표),
`null`(설정 전) = 예전처럼 Pro user 이상. 후보 = `GET /api/assignable-users`(아이콘+이름 `memberPickHtml`, `pro` 표시로 기본 체크) + [전체 선택/해제].
메뉴 표시만 정함(데이터는 멤버 범위 그대로) — 사이드바 `pj_all_view`(`_role_ctx(user, request)`), `project.js canAllView`(`data-all-view`). 대시보드 담당자별 합계는 여전히 Pro user 이상.
+- **알림 분류 — 매일 하는 업무 알림 시각**(2026-11-11) = 옵션 키 `daily_alert_times`(["HH:MM"…] 최대 12, 기본 ["09:00"], 빈 목록 = 끔). 행마다 시각 칸 + 휴지통, [알림 추가].
- 긴급 공지 = 수퍼관리자만.
## 연간 목표 (마이그레이션 013, `goal_*` 테이블, 6-9)
diff --git a/app/modules/project/db.py b/app/modules/project/db.py
index d0be6fb..e4f7b61 100644
--- a/app/modules/project/db.py
+++ b/app/modules/project/db.py
@@ -888,6 +888,14 @@ class ProjectStore:
for k in ("start_time", "due_time"):
if k in fields:
clean[k] = store.validate_time(fields[k])
+ # 매일 하는 업무(033) — 켜면 마감일·마감 시각을 비운다(마감일 없이 매일).
+ if "repeat_daily" in fields:
+ if not isinstance(fields["repeat_daily"], bool):
+ raise ValueError("매일 반복 값이 올바르지 않습니다.")
+ clean["repeat_daily"] = fields["repeat_daily"]
+ if fields["repeat_daily"]:
+ clean["due_date"] = None
+ clean["due_time"] = None
newly_assigned: str | None = None
newly_completed = False
@@ -899,7 +907,11 @@ class ProjectStore:
prev = self._serialize(row)
sets: list[str] = []
params: list[Any] = []
- for k in ("title", "description", "priority", "start_date", "due_date", "start_time", "due_time"):
+ # 마감일을 고르면 매일 반복은 꺼진다(열이 있을 때만 — 033 미적용이면 키가 없다)
+ if clean.get("due_date") and prev.get("repeat_daily") and "repeat_daily" not in clean:
+ clean["repeat_daily"] = False
+ for k in ("title", "description", "priority", "start_date", "due_date", "start_time", "due_time",
+ "repeat_daily"):
if k in clean:
sets.append(f"{k} = %s")
params.append(clean[k])
@@ -2268,9 +2280,27 @@ class ProjectStore:
).fetchall()
return [self._serialize(r) for r in rows]
+ def list_open_daily_tasks(self) -> list[dict[str, Any]]:
+ """매일 하는 업무(033 repeat_daily) 중 미완료 + 팔로워 목록. 보관 프로젝트는 뺀다.
+ 033 미적용이면 psycopg_errors.UndefinedColumn(알림 데몬이 그날은 건너뜀)."""
+ with self._pool.connection() as conn:
+ rows = conn.execute(
+ """
+ SELECT t.id, t.title, t.assignee_email, t.project_id, t.parent_task_id, p.name AS project_name,
+ COALESCE((SELECT array_agg(f.user_email ORDER BY f.user_email)
+ FROM task_followers f WHERE f.task_id = t.id),
+ '{}'::text[]) AS followers
+ FROM tasks t
+ JOIN projects p ON p.id = t.project_id
+ WHERE t.repeat_daily AND t.completed_at IS NULL AND p.status <> 'archived'
+ ORDER BY t.id
+ """,
+ ).fetchall()
+ return [self._serialize(r) for r in rows]
+
def add_reminder_notification(
self, *, task_id: int, kind: str, due_date: str, recipient_email: str,
- project_id: int | None, title: str, body: str,
+ project_id: int | None, title: str, body: str, ntype: str | None = None,
) -> bool:
"""마감 알림 발송 기록 + 수신함 알림을 한 트랜잭션에. 처음이면 둘 다 넣고 True,
이미 보냈으면(UNIQUE) False. 알림 생성이 실패하면 발송 기록도 되돌려져 다음 실행에서
@@ -2289,7 +2319,7 @@ class ProjectStore:
"INSERT INTO project_notifications "
"(recipient_email, actor_email, project_id, task_id, type, title, body) "
"VALUES (%s,'',%s,%s,%s,%s,%s)",
- (rcpt, project_id, task_id, kind, store.norm_str(title), store.norm_str(body)),
+ (rcpt, project_id, task_id, ntype or kind, store.norm_str(title), store.norm_str(body)),
)
return True
diff --git a/app/modules/project/reminders.py b/app/modules/project/reminders.py
index ea22564..3655ef9 100644
--- a/app/modules/project/reminders.py
+++ b/app/modules/project/reminders.py
@@ -15,6 +15,11 @@
"오늘 아직 안 돌았고, 설정 시각이 지났고, 영업일이면" 한 번 돈다. 여러 프로세스가
동시에 돌아도 위 UNIQUE 덕분에 중복 알림이 없다.
+매일 하는 업무(033 tasks.repeat_daily, run_daily_alerts) — Project 옵션 daily_alert_times 시각(KST, 영업일)이
+지나면 미완료 매일 업무의 담당자(없으면 협업자)에게 수신함 알림(type=daily, 큰 팝업에 따로 색). 데몬은 1분마다 깨어
+지난 시각 중 가장 늦은 것 하나만 보낸다(서버가 꺼져 있다 켜져도 몇 번씩 쏟아지지 않게). 중복 방지는 같은
+task_reminders(kind='daily@HH:MM', due_date=그날).
+
환경변수:
PROJECT_REMINDERS false 면 끈다(기본 켜짐)
PROJECT_REMINDER_HOUR 실행 시각(KST 0~23, 기본 9)
@@ -41,6 +46,7 @@ logger = logging.getLogger("project.reminders")
KIND_DUE_SOON = "due_soon"
KIND_DUE_TODAY = "due_today"
KIND_OVERDUE = "overdue"
+NTYPE_DAILY = "daily"
OVERDUE_WINDOW_DAYS = 7
@@ -139,6 +145,39 @@ def run_due_reminders(
return counts
+def daily_slot(times: list[str], hhmm: str) -> str | None:
+ """설정 시각들 중 지금(hhmm)까지 지난 가장 늦은 시각 — 없으면 None."""
+ passed = [t for t in times if t <= hhmm]
+ return max(passed) if passed else None
+
+
+def run_daily_alerts(
+ st: Any, *, today: date, slot: str, lookup: access.UserLookup | None = None,
+) -> int:
+ """매일 하는 업무 알림 한 번(그날 slot 시각분). 새로 만든 알림 수. 수신자·권한·중복 규칙은 마감 알림과 같다."""
+ made = 0
+ for t in st.list_open_daily_tasks():
+ assignee = store.norm_str(t.get("assignee_email"), lower=True)
+ wanted = [assignee] if assignee else store.normalize_emails(t.get("followers") or [])
+ try:
+ recipients = access.filter_recipients(st, t, wanted, lookup)
+ except Exception: # noqa: BLE001 - 권한 확인이 안 되면 이번엔 보내지 않는다
+ logger.warning("매일 업무 알림 수신자 확인 실패: task=%s", t["id"])
+ continue
+ for rcpt in recipients:
+ try:
+ created = st.add_reminder_notification(
+ task_id=t["id"], kind=f"daily@{slot}", due_date=today.isoformat(), recipient_email=rcpt,
+ project_id=t["project_id"], title=f"매일 업무: {t['title']}",
+ body=f"{t.get('project_name') or ''} · 매일 {slot}", ntype=NTYPE_DAILY,
+ )
+ except Exception: # noqa: BLE001 - 기록도 되돌려졌으니 다음 실행에서 다시 시도
+ logger.warning("매일 업무 알림 생성 실패(다음 실행에 재시도): task=%s", t["id"])
+ continue
+ made += int(bool(created))
+ return made
+
+
def _send_digests(digest: dict[str, list[tuple[str, dict[str, Any]]]], today: date) -> None:
from app.mail import send_email # noqa: WPS433
@@ -176,22 +215,41 @@ def start_reminder_thread(st: Any) -> bool:
def _loop() -> None:
last_run: date | None = None
+ last_due_try = 0.0
+ daily_done: tuple[date, str] | None = None # 마지막으로 보낸 (날짜, 시각)
while True:
+ now = now_kst()
+ today = now.date()
+ if time.monotonic() - last_due_try >= 300: # 마감 알림은 예전처럼 5분마다 확인
+ last_due_try = time.monotonic()
+ try:
+ if last_run != today and now.hour >= hour and is_workday(today):
+ counts = run_due_reminders(st, today=today)
+ last_run = today
+ logger.info("마감 알림 실행: %s", counts)
+ except Exception as exc: # noqa: BLE001
+ if type(exc).__name__ == "UndefinedTable":
+ # 008 마이그레이션 미적용 — 오늘은 더 시도하지 않는다(로그 도배 방지)
+ logger.warning("마감 알림 skip — project_db_008 마이그레이션 필요")
+ last_run = now_kst().date()
+ else:
+ logger.warning("마감 알림 실패(%s) — 5분 뒤 재시도", type(exc).__name__)
try:
- now = now_kst()
- today = now.date()
- if last_run != today and now.hour >= hour and is_workday(today):
- counts = run_due_reminders(st, today=today)
- last_run = today
- logger.info("마감 알림 실행: %s", counts)
+ if is_workday(today):
+ times = store.normalize_project_options(st.get_project_options())["daily_alert_times"]
+ slot = daily_slot(times, now.strftime("%H:%M"))
+ if slot and daily_done not in ((today, slot), (today, "skip")):
+ made = run_daily_alerts(st, today=today, slot=slot)
+ daily_done = (today, slot)
+ if made:
+ logger.info("매일 업무 알림 %s: %d건", slot, made)
except Exception as exc: # noqa: BLE001
- if type(exc).__name__ == "UndefinedTable":
- # 008 마이그레이션 미적용 — 오늘은 더 시도하지 않는다(로그 도배 방지)
- logger.warning("마감 알림 skip — project_db_008 마이그레이션 필요")
- last_run = now_kst().date()
+ if type(exc).__name__ in ("UndefinedColumn", "UndefinedTable"):
+ daily_done = (today, "skip") # 033(또는 008) 미적용 — 오늘은 그만(로그 도배 방지)
+ logger.warning("매일 업무 알림 skip — project_db_033 마이그레이션 필요")
else:
- logger.warning("마감 알림 실패(%s) — 5분 뒤 재시도", type(exc).__name__)
- time.sleep(300)
+ logger.warning("매일 업무 알림 실패(%s) — 1분 뒤 재시도", type(exc).__name__)
+ time.sleep(60)
threading.Thread(target=_loop, name="project-reminders", daemon=True).start()
return True
diff --git a/app/modules/project/router.py b/app/modules/project/router.py
index ef181f4..86f6fb3 100644
--- a/app/modules/project/router.py
+++ b/app/modules/project/router.py
@@ -1677,6 +1677,8 @@ def api_update_task(
try:
task = st.update_task(task_id=task_id, fields=payload, actor=user["email"],
assignee_allowed=_registered_project_user)
+ except UndefinedColumn:
+ raise HTTPException(status_code=503, detail="DB 마이그레이션 033(매일 하는 업무)이 아직 적용되지 않았습니다.")
except ValueError as exc:
raise HTTPException(status_code=400, detail=str(exc))
except KeyError:
@@ -2817,7 +2819,7 @@ def _alerts_payload(st: Any, user: dict[str, Any], after: int) -> dict[str, Any]
return out
-_ALERT_TYPES = ("mention", "assigned")
+_ALERT_TYPES = ("mention", "assigned", "daily") # daily = 매일 하는 업무(reminders.run_daily_alerts, 033)
_ALERT_MAX = 10 # 한 번에 띄우는 최대 건수(오래된 것부터 — 닫으면 그 뒤 것)
_ALERT_PAGE = 200
_ALERT_SCAN_PAGES = 25 # 한 번 확인에 읽는 최대 행(200 × 25) — 볼 수 없는 알림이 아주 많아도 요청이 끝나게
diff --git a/app/modules/project/store.py b/app/modules/project/store.py
index 1e685c8..549213b 100644
--- a/app/modules/project/store.py
+++ b/app/modules/project/store.py
@@ -384,8 +384,28 @@ PROJECT_OPTION_DEFAULTS: dict[str, Any] = {
"default_view": "board", # 왼쪽에서 프로젝트를 열 때 처음 보이는 탭
"board_cover": True, # 보드 카드 표지(설명의 첫 이미지)
"all_view_users": None, # 왼쪽 "전체 보기" 메뉴를 볼 사람(이메일 목록) — None = 예전처럼 Pro user 이상
+ "daily_alert_times": ["09:00"], # 매일 업무(033 repeat_daily) 알림 시각들(KST, 영업일)
}
ALL_VIEW_USERS_MAX = 2000
+DAILY_ALERT_TIMES_MAX = 12
+
+
+def _time_list(raw: Any) -> list[str] | None:
+ """'HH:MM' 목록 → 정규화·중복 제거·정렬. 목록이 아니거나 잘못된 시각이 끼면 None(빈 목록 = 알림 끔)."""
+ if not isinstance(raw, list) or len(raw) > DAILY_ALERT_TIMES_MAX:
+ return None
+ out: set[str] = set()
+ for t in raw:
+ if not isinstance(t, str):
+ return None
+ try:
+ v = validate_time(t)
+ except ValueError:
+ return None
+ if v is None:
+ return None
+ out.add(v)
+ return sorted(out)
def _email_list(raw: Any) -> list[str] | None:
@@ -410,6 +430,11 @@ def normalize_project_options(raw: dict[str, Any] | None) -> dict[str, Any]:
out["board_cover"] = raw["board_cover"]
if raw.get("all_view_users") is not None:
out["all_view_users"] = _email_list(raw["all_view_users"])
+ times = _time_list(raw.get("daily_alert_times"))
+ if times is not None:
+ out["daily_alert_times"] = times
+ else:
+ out["daily_alert_times"] = list(PROJECT_OPTION_DEFAULTS["daily_alert_times"])
return out
@@ -434,6 +459,11 @@ def validate_project_options(payload: Any) -> dict[str, Any]:
out["all_view_users"] = None if v is None else _email_list(v)
if v is not None and out["all_view_users"] is None:
raise ValueError("전체 보기 대상자 값이 올바르지 않습니다.")
+ if "daily_alert_times" in payload:
+ times = _time_list(payload["daily_alert_times"])
+ if times is None:
+ raise ValueError(f"매일 업무 알림 시각이 올바르지 않습니다(HH:MM, 최대 {DAILY_ALERT_TIMES_MAX}개).")
+ out["daily_alert_times"] = times
return out
diff --git a/app/modules/project/templates/project/_options.html b/app/modules/project/templates/project/_options.html
index c4b732c..997758a 100644
--- a/app/modules/project/templates/project/_options.html
+++ b/app/modules/project/templates/project/_options.html
@@ -3,6 +3,7 @@
· 프로젝트 화면(처음 여는 탭·"전체 보기" 메뉴 대상자)·보드(카드 표지) — 수퍼관리자·Admin(pj_admin)만 보이고, 서버(project_options, 마이그레이션 029)에
저장해 모든 사용자에게 적용. 창을 열 때 GET /project/api/options, 저장은 PUT. project.html 이 data-default-view·
data-board-cover 로 받아 project.js 가 쓴다. 저장하면 "pj-options-change" 이벤트로 보던 보드에 바로 반영.
+ · 알림(매일 하는 업무 알림 시각 여러 개) — 수퍼관리자·Admin, 모든 사용자.
· 관리자(긴급 공지) — 수퍼관리자만(공지 화면이 수퍼관리자 전용). #}
+
{% endif %}
{% if user and user.is_super_admin %}