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 + ]