fix: API endpoints for file_uuid filtering of pending identities
- get_file_identities: UNION face_detections + file_identities - list_identities: add file_bindings from file_identities table - Add back /api/v1/traces/unassigned route - Total count query now includes file_identities Frontend can now: - Filter pending identities by file_uuid - Filter pending faces (unassigned traces) by file_uuid
This commit is contained in:
@@ -266,10 +266,16 @@ async fn get_file_identities(
|
||||
})
|
||||
.collect();
|
||||
|
||||
let fi_table = crate::core::db::schema::table_name("file_identities");
|
||||
let total = match sqlx::query_scalar::<_, i64>(
|
||||
&format!(
|
||||
"SELECT COUNT(DISTINCT fd.identity_id) FROM {} fd WHERE fd.file_uuid = $1 AND fd.identity_id IS NOT NULL",
|
||||
crate::core::db::schema::table_name("face_detections")
|
||||
r#"SELECT COUNT(DISTINCT identity_id) FROM (
|
||||
SELECT identity_id FROM {} WHERE file_uuid = $1 AND identity_id IS NOT NULL
|
||||
UNION
|
||||
SELECT identity_id FROM {} WHERE file_uuid = $1
|
||||
) combined"#,
|
||||
crate::core::db::schema::table_name("face_detections"),
|
||||
fi_table
|
||||
)
|
||||
)
|
||||
.bind(&file_uuid)
|
||||
|
||||
Reference in New Issue
Block a user