fix(music-lab): pipeline 응답에 track_title 포함 (LEFT JOIN music_library)

This commit is contained in:
2026-05-07 17:43:55 +09:00
parent 868906b8c6
commit 4f67cd02fa

View File

@@ -958,7 +958,12 @@ def create_pipeline(track_id: int) -> int:
def get_pipeline(pid: int) -> Optional[Dict[str, Any]]: def get_pipeline(pid: int) -> Optional[Dict[str, Any]]:
with _conn() as conn: with _conn() as conn:
row = conn.execute("SELECT * FROM video_pipelines WHERE id = ?", (pid,)).fetchone() row = conn.execute("""
SELECT vp.*, ml.title AS track_title
FROM video_pipelines vp
LEFT JOIN music_library ml ON ml.id = vp.track_id
WHERE vp.id = ?
""", (pid,)).fetchone()
if not row: if not row:
return None return None
return _parse_pipeline_row(row) return _parse_pipeline_row(row)
@@ -985,15 +990,16 @@ def update_pipeline_state(pid: int, state: str, **fields) -> None:
def list_pipelines(active_only: bool = False) -> List[Dict[str, Any]]: def list_pipelines(active_only: bool = False) -> List[Dict[str, Any]]:
with _conn() as conn: sql = """
SELECT vp.*, ml.title AS track_title
FROM video_pipelines vp
LEFT JOIN music_library ml ON ml.id = vp.track_id
"""
if active_only: if active_only:
rows = conn.execute(""" sql += " WHERE vp.state NOT IN ('published','cancelled','failed','awaiting_manual')"
SELECT * FROM video_pipelines sql += " ORDER BY vp.created_at DESC"
WHERE state NOT IN ('published','cancelled','failed','awaiting_manual') with _conn() as conn:
ORDER BY created_at DESC rows = conn.execute(sql).fetchall()
""").fetchall()
else:
rows = conn.execute("SELECT * FROM video_pipelines ORDER BY created_at DESC").fetchall()
return [_parse_pipeline_row(r) for r in rows] return [_parse_pipeline_row(r) for r in rows]