fix(daily_digest): cast today to date object for KST comparison

매일 20:00 KST cron fire 시 fail:
  UndefinedFunctionError: operator does not exist: date = character varying

원인: today 가 strftime("%Y-%m-%d") 로 string, func.date(created_at) 가 date 타입.
PostgreSQL 가 date = string 비교 거부.

Fix: today = datetime.now(ZoneInfo("Asia/Seoul")).date() — date 객체로.
KST 기준은 scheduler cron 이 KST 20:00 에 fire 되므로 자연 일치.

scope: app/workers/daily_digest.py:24
This commit is contained in:
hyungi
2026-05-12 21:30:41 +00:00
parent 138f689c98
commit 2dbbeac1c7
+3 -1
View File
@@ -6,6 +6,7 @@ DEVONthink/OmniFocus → PostgreSQL/CalDAV 쿼리로 전환.
import os
from datetime import datetime, timezone
from zoneinfo import ZoneInfo
from pathlib import Path
from sqlalchemy import func, select, text
@@ -21,7 +22,8 @@ logger = setup_logger("daily_digest")
async def run():
"""일일 다이제스트 생성 + 저장 + 발송"""
today = datetime.now(timezone.utc).strftime("%Y-%m-%d")
# KST 기준 오늘 (cron 이 KST timezone fix 후 20:00 KST 에 fire). date 객체로 비교 — Document.created_at::date 와 직접 매칭.
today = datetime.now(ZoneInfo("Asia/Seoul")).date()
sections = []
async with async_session() as session: