fix(music-lab): trend report list에 top_genres/recommended_styles 포함

GET /api/music/market/report 응답에 top_genres, recommended_styles를 포함해
히스토리 리포트 클릭 시 장르 차트와 Suno 프롬프트가 비어 보이는 버그 수정.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-01 15:03:27 +09:00
parent 85e5f96379
commit 7c8d079f74

View File

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