fix: 링크 저장 및 에러 메시지 개선

- created_at 기본값이 없어도 저장되도록 NOW()로 기록
- API 오류 발생 시 detail을 함께 표시

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dsyoon
2026-02-08 11:43:03 +09:00
parent d076e08e27
commit 7df7c35434
2 changed files with 6 additions and 3 deletions

3
app.py
View File

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