From 7df7c35434e41367ecfb1a1ba3174c1203216558 Mon Sep 17 00:00:00 2001 From: dsyoon Date: Sun, 8 Feb 2026 11:43:03 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A7=81=ED=81=AC=20=EC=A0=80=EC=9E=A5?= =?UTF-8?q?=20=EB=B0=8F=20=EC=97=90=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80?= =?UTF-8?q?=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - created_at 기본값이 없어도 저장되도록 NOW()로 기록 - API 오류 발생 시 detail을 함께 표시 Co-authored-by: Cursor --- app.py | 3 ++- static/app.js | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 7a20d65..fe3a59d 100644 --- a/app.py +++ b/app.py @@ -238,7 +238,8 @@ def add_link(): with get_db_connection() as conn: with conn.cursor() as cur: cur.execute( - f"INSERT INTO {table} (url) VALUES (%s) RETURNING id, created_at", + # created_at에 DEFAULT가 없더라도 저장되도록 NOW()를 함께 기록 + f"INSERT INTO {table} (url, created_at) VALUES (%s, NOW()) RETURNING id, created_at", (url,), ) link_id, created_at = cur.fetchone() diff --git a/static/app.js b/static/app.js index 865eb9d..bdac5b1 100644 --- a/static/app.js +++ b/static/app.js @@ -118,7 +118,8 @@ async function loadNextPage() { const res = await fetch(`/links?limit=${PAGE_SIZE}&offset=${nextOffset}`); const data = await res.json(); if (!res.ok) { - throw new Error(data.error || "링크를 불러오지 못했습니다."); + const detail = data?.detail ? ` (${data.detail})` : ""; + throw new Error((data.error || "링크를 불러오지 못했습니다.") + detail); } const items = Array.isArray(data) ? data : data.items || []; @@ -164,7 +165,8 @@ linkForm.addEventListener("submit", async (event) => { }); const data = await res.json(); if (!res.ok) { - throw new Error(data.error || "저장에 실패했습니다."); + const detail = data?.detail ? ` (${data.detail})` : ""; + throw new Error((data.error || "저장에 실패했습니다.") + detail); } resetPagination();