fix: remove sqlx from API layer, read TTL from TranscodeManager, init local_files from DB on startup
This commit is contained in:
@@ -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(),
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user