fix: remove sqlx from API layer, read TTL from TranscodeManager, init local_files from DB on startup

This commit is contained in:
2026-03-16 04:08:52 +01:00
parent d88afbfe2e
commit 50df852416
3 changed files with 54 additions and 19 deletions

View File

@@ -256,17 +256,10 @@ async fn get_transcode_settings(
State(state): State<AppState>,
CurrentUser(_user): CurrentUser,
) -> Result<Json<TranscodeSettingsResponse>, ApiError> {
let pool = state.sqlite_pool.read().await.clone()
.ok_or_else(|| ApiError::not_implemented("sqlite not available"))?;
let (ttl,): (i64,) =
sqlx::query_as("SELECT cleanup_ttl_hours FROM transcode_settings WHERE id = 1")
.fetch_one(&pool)
.await
.map_err(|e| ApiError::internal(e.to_string()))?;
let tm = state.transcode_manager.read().await.clone()
.ok_or_else(|| ApiError::not_implemented("TRANSCODE_DIR not configured"))?;
Ok(Json(TranscodeSettingsResponse {
cleanup_ttl_hours: ttl as u32,
cleanup_ttl_hours: tm.get_cleanup_ttl(),
}))
}