fix: search frames SQL alias bug, visual search serde default, identity JSON hyphen lookup
This commit is contained in:
@@ -475,6 +475,9 @@ pub struct IdentityChunkItem {
|
||||
pub file_uuid: String,
|
||||
pub chunk_id: String,
|
||||
pub chunk_type: String,
|
||||
pub start_frame: i64,
|
||||
pub end_frame: i64,
|
||||
pub fps: f64,
|
||||
pub start_time: Option<f64>,
|
||||
pub end_time: Option<f64>,
|
||||
pub text_content: Option<String>,
|
||||
@@ -504,6 +507,9 @@ async fn get_identity_chunks(
|
||||
file_uuid: r.file_uuid,
|
||||
chunk_id: r.chunk_id,
|
||||
chunk_type: r.chunk_type,
|
||||
start_frame: r.start_frame,
|
||||
end_frame: r.end_frame,
|
||||
fps: r.fps,
|
||||
start_time: r.start_time,
|
||||
end_time: r.end_time,
|
||||
text_content: r.text_content,
|
||||
@@ -788,16 +794,24 @@ async fn get_profile_image(
|
||||
async fn get_identity_json(
|
||||
Path(identity_uuid): Path<String>,
|
||||
) -> Result<(StatusCode, [(String, String); 1], Vec<u8>), StatusCode> {
|
||||
let path = crate::core::identity::storage::identity_file_path(&identity_uuid);
|
||||
if !path.exists() {
|
||||
return Err(StatusCode::NOT_FOUND);
|
||||
let clean = identity_uuid.replace('-', "");
|
||||
let with_hyphens = if clean.len() == 32 {
|
||||
format!("{}-{}-{}-{}-{}", &clean[0..8], &clean[8..12], &clean[12..16], &clean[16..20], &clean[20..32])
|
||||
} else {
|
||||
identity_uuid.clone()
|
||||
};
|
||||
for u in [&clean, &identity_uuid, &with_hyphens] {
|
||||
let p = crate::core::identity::storage::identity_file_path(u);
|
||||
if p.exists() {
|
||||
let data = std::fs::read(&p).map_err(|_| StatusCode::NOT_FOUND)?;
|
||||
return Ok((
|
||||
StatusCode::OK,
|
||||
[("content-type".to_string(), "application/json".to_string())],
|
||||
data,
|
||||
));
|
||||
}
|
||||
}
|
||||
let data = std::fs::read(&path).map_err(|_| StatusCode::NOT_FOUND)?;
|
||||
Ok((
|
||||
StatusCode::OK,
|
||||
[("content-type".to_string(), "application/json".to_string())],
|
||||
data,
|
||||
))
|
||||
Err(StatusCode::NOT_FOUND)
|
||||
}
|
||||
|
||||
// ── Experiment: Identity Text Search ──────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user