feat: update_identity_status command + People ignore action
This commit is contained in:
@@ -171,8 +171,10 @@ async fn get_people(_page: usize, _per_page: usize) -> Result<Vec<PersonInfo>, S
|
||||
}
|
||||
}
|
||||
|
||||
eprintln!("[get_people] page {} got {} identities", page, identities.len());
|
||||
if identities.len() < 100 { break; }
|
||||
eprintln!("[get_people] page {} got {} identities, total so far: {}", page, identities.len(), all_people.len());
|
||||
|
||||
// API max is 20 per page, keep fetching until we get fewer than 20
|
||||
if identities.len() < 20 { break; }
|
||||
page += 1;
|
||||
}
|
||||
|
||||
@@ -297,6 +299,20 @@ async fn update_identity_name(uuid: String, name: String) -> Result<(), String>
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "camelCase")]
|
||||
async fn update_identity_status(uuid: String, status: String) -> Result<(), String> {
|
||||
let client = reqwest::Client::new();
|
||||
let url = format!("{}/api/v1/identity/{}?api_key={}", CORE_API, uuid, API_KEY);
|
||||
let resp = client.patch(&url)
|
||||
.json(&serde_json::json!({"status": status}))
|
||||
.send().await
|
||||
.map_err(|e| format!("Request failed: {}", e))?;
|
||||
if !resp.status().is_success() {
|
||||
return Err(format!("Update failed: {}", resp.status()));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "camelCase")]
|
||||
async fn delete_identity(uuid: String) -> Result<(), String> {
|
||||
let client = reqwest::Client::new();
|
||||
@@ -415,6 +431,7 @@ fn main() {
|
||||
get_video_stream,
|
||||
get_identity_profile,
|
||||
update_identity_name,
|
||||
update_identity_status,
|
||||
delete_identity,
|
||||
search_identities,
|
||||
get_face_candidates,
|
||||
|
||||
Reference in New Issue
Block a user