fix: scan extensions add jpg/png, /files status from DB (2/4 M4 items)

This commit is contained in:
Accusys
2026-05-13 20:43:37 +08:00
parent 50d38a5473
commit 2e7dd44552
3 changed files with 6 additions and 6 deletions

View File

@@ -94,7 +94,7 @@ async fn list_files(
file_uuid: r.file_uuid,
file_name: r.file_name,
file_path: r.file_path,
status: "ready".to_string(), // Hardcoded for now
status: r.status.unwrap_or_default(),
})
.collect();

View File

@@ -1891,7 +1891,7 @@ async fn scan_files(State(state): State<AppState>) -> Result<Json<ScanFilesRespo
.unwrap_or_else(|_| "/Users/accusys/momentry/var/sftpgo/data/demo".to_string());
let demo_dir = std::path::Path::new(&demo_dir_str);
let allowed_extensions = vec!["mp4", "mov", "mkv", "avi", "webm"];
let allowed_extensions = vec!["mp4", "mov", "mkv", "avi", "webm", "jpg", "jpeg", "png", "gif", "webp"];
// 1. Get registered files from DB (Map key: absolute file_path)
let table = schema::table_name("videos");

View File

@@ -42,6 +42,7 @@ pub struct FileRecord {
pub file_uuid: String,
pub file_path: String,
pub file_name: String,
pub status: Option<String>,
pub probe_json: Option<serde_json::Value>,
pub created_at: Option<chrono::DateTime<chrono::Utc>>,
}
@@ -2358,7 +2359,7 @@ impl PostgresDb {
pub async fn list_files(&self, limit: i32, offset: i64) -> Result<Vec<FileRecord>> {
let query = r#"
SELECT file_uuid, file_path, file_name, probe_json, created_at
SELECT file_uuid, file_path, file_name, status, probe_json, created_at
FROM videos
ORDER BY created_at DESC
LIMIT $1 OFFSET $2
@@ -2375,9 +2376,8 @@ impl PostgresDb {
pub async fn get_file_by_uuid(&self, uuid: &str) -> Result<Option<FileRecord>> {
let query = r#"
SELECT file_uuid, file_path, file_name, probe_json, created_at
FROM videos
WHERE file_uuid = $1
SELECT file_uuid, file_path, file_name, status, probe_json, created_at
FROM videos WHERE file_uuid = $1
"#;
let row = sqlx::query_as(query)