fix: add identity_uuid to /identities list + /file/:uuid/identities responses

This commit is contained in:
Accusys
2026-05-15 10:14:22 +08:00
parent fdcec82274
commit 37799fff4e
3 changed files with 11 additions and 6 deletions

View File

@@ -58,6 +58,7 @@ pub struct CandidateRecord {
#[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)]
pub struct FileIdentityRecord {
pub identity_id: i32,
pub identity_uuid: Option<uuid::Uuid>,
pub name: String,
pub metadata: serde_json::Value,
pub face_count: Option<i32>,
@@ -2406,7 +2407,7 @@ impl PostgresDb {
let videos_table = schema::table_name("videos");
let query = format!(
r#"
SELECT fd.identity_id::int4, i.name, i.metadata,
SELECT fd.identity_id::int4, i.uuid as identity_uuid, i.name, i.metadata,
COUNT(*)::int4 as face_count,
0::int4 as speaker_count,
MIN(fd.frame_number) as start_frame,
@@ -2416,7 +2417,7 @@ impl PostgresDb {
FROM {} fd
JOIN {} i ON fd.identity_id = i.id
WHERE fd.file_uuid = $1 AND fd.identity_id IS NOT NULL
GROUP BY fd.identity_id, i.name, i.metadata
GROUP BY fd.identity_id, i.name, i.metadata, i.uuid
ORDER BY confidence DESC
LIMIT $2 OFFSET $3
"#,