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();