From 7c8d079f74b520023a8c35099ddb0dceb051d9a3 Mon Sep 17 00:00:00 2001 From: gahusb Date: Fri, 1 May 2026 15:03:27 +0900 Subject: [PATCH] =?UTF-8?q?fix(music-lab):=20trend=20report=20list?= =?UTF-8?q?=EC=97=90=20top=5Fgenres/recommended=5Fstyles=20=ED=8F=AC?= =?UTF-8?q?=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GET /api/music/market/report 응답에 top_genres, recommended_styles를 포함해 히스토리 리포트 클릭 시 장르 차트와 Suno 프롬프트가 비어 보이는 버그 수정. Co-Authored-By: Claude Sonnet 4.6 --- music-lab/app/db.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/music-lab/app/db.py b/music-lab/app/db.py index df4c31d..cef00db 100644 --- a/music-lab/app/db.py +++ b/music-lab/app/db.py @@ -694,9 +694,16 @@ def get_latest_trend_report() -> Optional[Dict[str, Any]]: def get_trend_reports(limit: int = 10) -> list: with _conn() as conn: rows = conn.execute( - "SELECT id, report_date, insights, created_at FROM trend_reports " - "ORDER BY report_date DESC LIMIT ?", (limit,) + "SELECT * FROM trend_reports ORDER BY report_date DESC LIMIT ?", (limit,) ).fetchall() - return [{"id": r["id"], "report_date": r["report_date"], - "insights": r["insights"][:100], "created_at": r["created_at"]} - for r in rows] + return [ + { + "id": r["id"], + "report_date": r["report_date"], + "top_genres": json.loads(r["top_genres"] or "[]"), + "recommended_styles": json.loads(r["recommended_styles"] or "[]"), + "insights": (r["insights"] or "")[:100], + "created_at": r["created_at"], + } + for r in rows + ]