fix(server/client): rename document_id to id in DocumentUploadResponse, again

This commit is contained in:
perf3ct 2025-07-09 01:40:50 +00:00
parent 55c91cc027
commit 17f486a8b7
13 changed files with 62 additions and 62 deletions

View File

@ -109,7 +109,7 @@ pub async fn upload_document(
} }
Ok(Json(DocumentUploadResponse { Ok(Json(DocumentUploadResponse {
document_id: document.id, id: document.id,
filename: document.filename, filename: document.filename,
file_size: document.file_size, file_size: document.file_size,
mime_type: document.mime_type, mime_type: document.mime_type,
@ -120,7 +120,7 @@ pub async fn upload_document(
Ok(IngestionResult::ExistingDocument(existing_doc)) => { Ok(IngestionResult::ExistingDocument(existing_doc)) => {
warn!("Duplicate document upload attempted: {}", existing_doc.id); warn!("Duplicate document upload attempted: {}", existing_doc.id);
Ok(Json(DocumentUploadResponse { Ok(Json(DocumentUploadResponse {
document_id: existing_doc.id, id: existing_doc.id,
filename: existing_doc.filename, filename: existing_doc.filename,
file_size: existing_doc.file_size, file_size: existing_doc.file_size,
mime_type: existing_doc.mime_type, mime_type: existing_doc.mime_type,

View File

@ -29,7 +29,7 @@ pub struct DeleteLowConfidenceRequest {
#[derive(Deserialize, Serialize, ToSchema)] #[derive(Deserialize, Serialize, ToSchema)]
pub struct DocumentUploadResponse { pub struct DocumentUploadResponse {
pub document_id: uuid::Uuid, pub id: uuid::Uuid,
pub filename: String, pub filename: String,
pub file_size: i64, pub file_size: i64,
pub mime_type: String, pub mime_type: String,

View File

@ -381,25 +381,25 @@ async fn test_single_document_deletion_success() {
let document = client.upload_document(test_content, "test_deletion.txt") let document = client.upload_document(test_content, "test_deletion.txt")
.await.expect("Failed to upload document"); .await.expect("Failed to upload document");
println!("Uploaded document: {}", document.document_id); println!("Uploaded document: {}", document.id);
// Verify document exists // Verify document exists
let retrieved_doc = client.get_document(&document.document_id.to_string()) let retrieved_doc = client.get_document(&document.id.to_string())
.await.expect("Failed to get document"); .await.expect("Failed to get document");
assert!(retrieved_doc.is_some(), "Document should exist before deletion"); assert!(retrieved_doc.is_some(), "Document should exist before deletion");
// Delete the document // Delete the document
let delete_result = client.delete_document(&document.document_id.to_string()) let delete_result = client.delete_document(&document.id.to_string())
.await.expect("Failed to delete document"); .await.expect("Failed to delete document");
// Verify deletion response (server returns 204 No Content, so we get our fallback response) // Verify deletion response (server returns 204 No Content, so we get our fallback response)
assert_eq!(delete_result["success"], true); assert_eq!(delete_result["success"], true);
assert_eq!(delete_result["document_id"], document.document_id.to_string()); assert_eq!(delete_result["id"], document.id.to_string());
// Note: filename is "deleted" because server returns empty response // Note: filename is "deleted" because server returns empty response
assert_eq!(delete_result["filename"], "deleted"); assert_eq!(delete_result["filename"], "deleted");
// Verify document no longer exists // Verify document no longer exists
let retrieved_doc_after = client.get_document(&document.document_id.to_string()) let retrieved_doc_after = client.get_document(&document.id.to_string())
.await.expect("Failed to check document existence"); .await.expect("Failed to check document existence");
assert!(retrieved_doc_after.is_none(), "Document should not exist after deletion"); assert!(retrieved_doc_after.is_none(), "Document should not exist after deletion");
@ -425,7 +425,7 @@ async fn test_bulk_document_deletion_success() {
let test_content = format!("This is test document number {}", i); let test_content = format!("This is test document number {}", i);
let document = client.upload_document(test_content.as_bytes(), &format!("test_bulk_{}.txt", i)) let document = client.upload_document(test_content.as_bytes(), &format!("test_bulk_{}.txt", i))
.await.expect("Failed to upload document"); .await.expect("Failed to upload document");
document_ids.push(document.document_id.to_string()); document_ids.push(document.id.to_string());
} }
println!("Uploaded {} documents for bulk deletion", document_ids.len()); println!("Uploaded {} documents for bulk deletion", document_ids.len());
@ -536,7 +536,7 @@ async fn test_bulk_delete_mixed_existing_nonexistent() {
// Create a list with real and fake IDs // Create a list with real and fake IDs
let fake_id = Uuid::new_v4().to_string(); let fake_id = Uuid::new_v4().to_string();
let mixed_ids = vec![real_document.document_id.to_string(), fake_id]; let mixed_ids = vec![real_document.id.to_string(), fake_id];
// Perform bulk deletion // Perform bulk deletion
let delete_result = client.bulk_delete_documents(&mixed_ids) let delete_result = client.bulk_delete_documents(&mixed_ids)
@ -554,10 +554,10 @@ async fn test_bulk_delete_mixed_existing_nonexistent() {
.collect(); .collect();
assert_eq!(deleted_ids.len(), 1); assert_eq!(deleted_ids.len(), 1);
assert_eq!(deleted_ids[0], real_document.document_id.to_string()); assert_eq!(deleted_ids[0], real_document.id.to_string());
// Verify real document was deleted // Verify real document was deleted
let retrieved_doc = client.get_document(&real_document.document_id.to_string()) let retrieved_doc = client.get_document(&real_document.id.to_string())
.await.expect("Failed to check document existence"); .await.expect("Failed to check document existence");
assert!(retrieved_doc.is_none(), "Real document should be deleted"); assert!(retrieved_doc.is_none(), "Real document should be deleted");
@ -613,7 +613,7 @@ async fn test_cross_user_deletion_protection() {
.await.expect("Failed to upload document as user 1"); .await.expect("Failed to upload document as user 1");
// User 2 tries to delete user 1's document // User 2 tries to delete user 1's document
let delete_result = client2.delete_document(&user1_document.document_id.to_string()).await; let delete_result = client2.delete_document(&user1_document.id.to_string()).await;
// Should return 404 (document not found for user 2) // Should return 404 (document not found for user 2)
assert!(delete_result.is_err(), "Cross-user deletion should fail"); assert!(delete_result.is_err(), "Cross-user deletion should fail");
@ -621,7 +621,7 @@ async fn test_cross_user_deletion_protection() {
assert!(error_msg.contains("404"), "Should return 404 for document not owned by user"); assert!(error_msg.contains("404"), "Should return 404 for document not owned by user");
// Verify user 1's document still exists // Verify user 1's document still exists
let retrieved_doc = client1.get_document(&user1_document.document_id.to_string()) let retrieved_doc = client1.get_document(&user1_document.id.to_string())
.await.expect("Failed to check document existence"); .await.expect("Failed to check document existence");
assert!(retrieved_doc.is_some(), "User 1's document should still exist after failed cross-user deletion"); assert!(retrieved_doc.is_some(), "User 1's document should still exist after failed cross-user deletion");
@ -659,15 +659,15 @@ async fn test_admin_can_delete_any_document() {
.await.expect("Failed to upload document as user"); .await.expect("Failed to upload document as user");
// Admin deletes user's document // Admin deletes user's document
let delete_result = admin_client.delete_document(&user_document.document_id.to_string()) let delete_result = admin_client.delete_document(&user_document.id.to_string())
.await.expect("Admin should be able to delete any document"); .await.expect("Admin should be able to delete any document");
// Verify deletion response // Verify deletion response
assert_eq!(delete_result["success"], true); assert_eq!(delete_result["success"], true);
assert_eq!(delete_result["document_id"], user_document.document_id.to_string()); assert_eq!(delete_result["id"], user_document.id.to_string());
// Verify document no longer exists // Verify document no longer exists
let retrieved_doc = user_client.get_document(&user_document.document_id.to_string()) let retrieved_doc = user_client.get_document(&user_document.id.to_string())
.await.expect("Failed to check document existence"); .await.expect("Failed to check document existence");
assert!(retrieved_doc.is_none(), "Document should be deleted by admin"); assert!(retrieved_doc.is_none(), "Document should be deleted by admin");
@ -711,8 +711,8 @@ async fn test_document_count_updates_after_deletion() {
let test_content = format!("Test document {}", i); let test_content = format!("Test document {}", i);
let document = client.upload_document(test_content.as_bytes(), &format!("count_test_{}.txt", i)) let document = client.upload_document(test_content.as_bytes(), &format!("count_test_{}.txt", i))
.await.expect("Failed to upload document"); .await.expect("Failed to upload document");
document_ids.push(document.document_id.to_string()); document_ids.push(document.id.to_string());
println!("📤 Uploaded document {}: {}", i, document.document_id); println!("📤 Uploaded document {}: {}", i, document.id);
} }
// Wait a moment for documents to be indexed // Wait a moment for documents to be indexed

View File

@ -196,7 +196,7 @@ mod document_routes_deletion_tests {
assert_eq!(success_response["success"], true); assert_eq!(success_response["success"], true);
assert!(success_response["message"].is_string()); assert!(success_response["message"].is_string());
assert_eq!(success_response["document_id"], document.id.to_string()); assert_eq!(success_response["id"], document.id.to_string());
// Test error response format // Test error response format
let error_response = json!({ let error_response = json!({

View File

@ -150,7 +150,7 @@ mod tests {
}); });
assert!(ocr_response.is_object()); assert!(ocr_response.is_object());
assert_eq!(ocr_response["document_id"], document.id.to_string()); assert_eq!(ocr_response["id"], document.id.to_string());
assert_eq!(ocr_response["filename"], document.filename); assert_eq!(ocr_response["filename"], document.filename);
assert_eq!(ocr_response["has_ocr_text"], true); assert_eq!(ocr_response["has_ocr_text"], true);
assert_eq!(ocr_response["ocr_text"], document.ocr_text.unwrap()); assert_eq!(ocr_response["ocr_text"], document.ocr_text.unwrap());

View File

@ -166,7 +166,7 @@ impl FileProcessingTestClient {
println!("🟢 DEBUG: Upload response: {}", response_text); println!("🟢 DEBUG: Upload response: {}", response_text);
let document: DocumentUploadResponse = serde_json::from_str(&response_text)?; let document: DocumentUploadResponse = serde_json::from_str(&response_text)?;
println!("✅ DEBUG: Successfully parsed document: {}", document.document_id); println!("✅ DEBUG: Successfully parsed document: {}", document.id);
Ok(document) Ok(document)
} }
@ -198,7 +198,7 @@ impl FileProcessingTestClient {
println!("🟢 DEBUG: Binary upload response: {}", response_text); println!("🟢 DEBUG: Binary upload response: {}", response_text);
let document: DocumentUploadResponse = serde_json::from_str(&response_text)?; let document: DocumentUploadResponse = serde_json::from_str(&response_text)?;
println!("✅ DEBUG: Successfully parsed binary document: {}", document.document_id); println!("✅ DEBUG: Successfully parsed binary document: {}", document.id);
Ok(document) Ok(document)
} }
@ -367,7 +367,7 @@ End of test document."#;
let document = client.upload_file(text_content, "test_pipeline.txt", "text/plain").await let document = client.upload_file(text_content, "test_pipeline.txt", "text/plain").await
.expect("Failed to upload text file"); .expect("Failed to upload text file");
let document_id = document.document_id.to_string(); let document_id = document.id.to_string();
println!("✅ Text file uploaded: {}", document_id); println!("✅ Text file uploaded: {}", document_id);
// Validate initial document properties // Validate initial document properties
@ -402,7 +402,7 @@ End of test document."#;
let ocr_results = client.get_ocr_results(&document_id).await let ocr_results = client.get_ocr_results(&document_id).await
.expect("Failed to get OCR results"); .expect("Failed to get OCR results");
assert_eq!(ocr_results["document_id"], document_id); assert_eq!(ocr_results["id"], document_id);
assert_eq!(ocr_results["has_ocr_text"], true); assert_eq!(ocr_results["has_ocr_text"], true);
if let Some(ocr_text) = ocr_results["ocr_text"].as_str() { if let Some(ocr_text) = ocr_results["ocr_text"].as_str() {
@ -471,7 +471,7 @@ async fn test_multiple_file_format_support() {
match client.upload_file(content, filename, mime_type).await { match client.upload_file(content, filename, mime_type).await {
Ok(document) => { Ok(document) => {
println!("✅ Uploaded {}: {}", filename, document.document_id); println!("✅ Uploaded {}: {}", filename, document.id);
uploaded_documents.push((document, mime_type, filename, content)); uploaded_documents.push((document, mime_type, filename, content));
} }
Err(e) => { Err(e) => {
@ -487,7 +487,7 @@ async fn test_multiple_file_format_support() {
for (document, mime_type, filename, original_content) in &uploaded_documents { for (document, mime_type, filename, original_content) in &uploaded_documents {
println!("🔄 Processing {} ({})...", filename, mime_type); println!("🔄 Processing {} ({})...", filename, mime_type);
let document_id = document.document_id.to_string(); let document_id = document.id.to_string();
// Wait for processing (with shorter timeout for multiple files) // Wait for processing (with shorter timeout for multiple files)
match client.wait_for_processing(&document_id).await { match client.wait_for_processing(&document_id).await {
@ -496,7 +496,7 @@ async fn test_multiple_file_format_support() {
// Test OCR results // Test OCR results
if let Ok(ocr_results) = client.get_ocr_results(&document_id).await { if let Ok(ocr_results) = client.get_ocr_results(&document_id).await {
assert_eq!(ocr_results["document_id"], document_id); assert_eq!(ocr_results["id"], document_id);
if ocr_results["has_ocr_text"] == true { if ocr_results["has_ocr_text"] == true {
if let Some(ocr_text) = ocr_results["ocr_text"].as_str() { if let Some(ocr_text) = ocr_results["ocr_text"].as_str() {
@ -554,7 +554,7 @@ async fn test_image_processing_pipeline() {
let document = client.upload_binary_file(png_data.clone(), "test_image.png", "image/png").await let document = client.upload_binary_file(png_data.clone(), "test_image.png", "image/png").await
.expect("Failed to upload PNG image"); .expect("Failed to upload PNG image");
let document_id = document.document_id.to_string(); let document_id = document.id.to_string();
println!("✅ PNG image uploaded: {}", document_id); println!("✅ PNG image uploaded: {}", document_id);
// Validate image document properties // Validate image document properties
@ -621,7 +621,7 @@ async fn test_image_processing_pipeline() {
let ocr_results = client.get_ocr_results(&document_id).await let ocr_results = client.get_ocr_results(&document_id).await
.expect("Failed to get OCR results for image"); .expect("Failed to get OCR results for image");
assert_eq!(ocr_results["document_id"], document_id); assert_eq!(ocr_results["id"], document_id);
// Image might not have text, so OCR could be empty // Image might not have text, so OCR could be empty
if ocr_results["has_ocr_text"] == true { if ocr_results["has_ocr_text"] == true {
@ -657,10 +657,10 @@ async fn test_processing_error_recovery() {
let empty_result = client.upload_file("", "empty.txt", "text/plain").await; let empty_result = client.upload_file("", "empty.txt", "text/plain").await;
match empty_result { match empty_result {
Ok(document) => { Ok(document) => {
println!("✅ Empty file uploaded: {}", document.document_id); println!("✅ Empty file uploaded: {}", document.id);
// Try to process empty file // Try to process empty file
match client.wait_for_processing(&document.document_id.to_string()).await { match client.wait_for_processing(&document.id.to_string()).await {
Ok(processed) => { Ok(processed) => {
println!("✅ Empty file processing completed: {:?}", processed.ocr_status); println!("✅ Empty file processing completed: {:?}", processed.ocr_status);
} }
@ -682,7 +682,7 @@ async fn test_processing_error_recovery() {
match large_result { match large_result {
Ok(document) => { Ok(document) => {
println!("✅ Large file uploaded: {} (size: {} bytes)", document.document_id, document.file_size); println!("✅ Large file uploaded: {} (size: {} bytes)", document.id, document.file_size);
// Give more time for large file processing // Give more time for large file processing
let start = Instant::now(); let start = Instant::now();
@ -697,7 +697,7 @@ async fn test_processing_error_recovery() {
if let Ok(resp) = response { if let Ok(resp) = response {
if let Ok(docs) = resp.json::<Vec<DocumentResponse>>().await { if let Ok(docs) = resp.json::<Vec<DocumentResponse>>().await {
if let Some(doc) = docs.iter().find(|d| d.id.to_string() == document.document_id.to_string()) { if let Some(doc) = docs.iter().find(|d| d.id.to_string() == document.id.to_string()) {
match doc.ocr_status.as_deref() { match doc.ocr_status.as_deref() {
Some("completed") => { Some("completed") => {
println!("✅ Large file processing completed"); println!("✅ Large file processing completed");
@ -732,10 +732,10 @@ async fn test_processing_error_recovery() {
match corrupted_result { match corrupted_result {
Ok(document) => { Ok(document) => {
println!("✅ Corrupted file uploaded: {}", document.document_id); println!("✅ Corrupted file uploaded: {}", document.id);
// Processing should handle the mismatch gracefully // Processing should handle the mismatch gracefully
match client.wait_for_processing(&document.document_id.to_string()).await { match client.wait_for_processing(&document.id.to_string()).await {
Ok(processed) => { Ok(processed) => {
println!("✅ Corrupted file processed: {:?}", processed.ocr_status); println!("✅ Corrupted file processed: {:?}", processed.ocr_status);
} }
@ -757,10 +757,10 @@ async fn test_processing_error_recovery() {
match special_result { match special_result {
Ok(document) => { Ok(document) => {
println!("✅ File with special characters uploaded: {}", document.document_id); println!("✅ File with special characters uploaded: {}", document.id);
println!("✅ Filename preserved: {}", document.filename); println!("✅ Filename preserved: {}", document.filename);
match client.wait_for_processing(&document.document_id.to_string()).await { match client.wait_for_processing(&document.id.to_string()).await {
Ok(_) => println!("✅ Special filename file processed successfully"), Ok(_) => println!("✅ Special filename file processed successfully"),
Err(e) => println!("⚠️ Special filename file processing failed: {}", e), Err(e) => println!("⚠️ Special filename file processing failed: {}", e),
} }
@ -806,12 +806,12 @@ async fn test_pipeline_performance_monitoring() {
println!("{} uploaded in {:?}", filename, upload_time); println!("{} uploaded in {:?}", filename, upload_time);
// Wait for processing and measure time // Wait for processing and measure time
match client.wait_for_processing(&document.document_id.to_string()).await { match client.wait_for_processing(&document.id.to_string()).await {
Ok(processed_doc) => { Ok(processed_doc) => {
let total_processing_time = processing_start.elapsed(); let total_processing_time = processing_start.elapsed();
// Get OCR results to check reported processing time // Get OCR results to check reported processing time
if let Ok(ocr_results) = client.get_ocr_results(&document.document_id.to_string()).await { if let Ok(ocr_results) = client.get_ocr_results(&document.id.to_string()).await {
let reported_time = ocr_results["ocr_processing_time_ms"] let reported_time = ocr_results["ocr_processing_time_ms"]
.as_i64() .as_i64()
.map(|ms| Duration::from_millis(ms as u64)); .map(|ms| Duration::from_millis(ms as u64));
@ -954,7 +954,7 @@ async fn test_concurrent_file_processing() {
for handle in upload_handles { for handle in upload_handles {
match handle.await.expect("Upload task should complete") { match handle.await.expect("Upload task should complete") {
Ok((index, document, upload_time)) => { Ok((index, document, upload_time)) => {
println!("✅ Document {} uploaded in {:?}: {}", index + 1, upload_time, document.document_id); println!("✅ Document {} uploaded in {:?}: {}", index + 1, upload_time, document.id);
uploaded_documents.push(document); uploaded_documents.push(document);
} }
Err((index, error)) => { Err((index, error)) => {
@ -972,7 +972,7 @@ async fn test_concurrent_file_processing() {
for document in uploaded_documents { for document in uploaded_documents {
let token = client.token.clone().unwrap(); let token = client.token.clone().unwrap();
let client_clone = client.client.clone(); let client_clone = client.client.clone();
let document_id = document.document_id.to_string(); let document_id = document.id.to_string();
let handle = tokio::spawn(async move { let handle = tokio::spawn(async move {
let start = Instant::now(); let start = Instant::now();
@ -1125,18 +1125,18 @@ async fn test_real_test_images_processing() {
}; };
let upload_time = upload_start.elapsed(); let upload_time = upload_start.elapsed();
println!("{} uploaded in {:?}: {}", test_image.filename, upload_time, document.document_id); println!("{} uploaded in {:?}: {}", test_image.filename, upload_time, document.id);
// Wait for OCR processing // Wait for OCR processing
let processing_start = std::time::Instant::now(); let processing_start = std::time::Instant::now();
match client.wait_for_processing(&document.document_id.to_string()).await { match client.wait_for_processing(&document.id.to_string()).await {
Ok(processed_doc) => { Ok(processed_doc) => {
let processing_time = processing_start.elapsed(); let processing_time = processing_start.elapsed();
println!("{} processed in {:?}: status = {:?}", println!("{} processed in {:?}: status = {:?}",
test_image.filename, processing_time, processed_doc.ocr_status); test_image.filename, processing_time, processed_doc.ocr_status);
// Get OCR results and verify content // Get OCR results and verify content
if let Ok(ocr_results) = client.get_ocr_results(&document.document_id.to_string()).await { if let Ok(ocr_results) = client.get_ocr_results(&document.id.to_string()).await {
if let Some(ocr_text) = ocr_results["ocr_text"].as_str() { if let Some(ocr_text) = ocr_results["ocr_text"].as_str() {
let normalized_ocr = ocr_text.trim().to_lowercase(); let normalized_ocr = ocr_text.trim().to_lowercase();
let normalized_expected = test_image.expected_content.as_ref().map(|s| s.trim().to_lowercase()).unwrap_or_default(); let normalized_expected = test_image.expected_content.as_ref().map(|s| s.trim().to_lowercase()).unwrap_or_default();

View File

@ -219,7 +219,7 @@ Technology: Rust + Axum + SQLx"#;
let document = client.upload_document(test_content, "rust_test.txt").await let document = client.upload_document(test_content, "rust_test.txt").await
.expect("Failed to upload document"); .expect("Failed to upload document");
println!("✅ Document uploaded: {}", document.document_id); println!("✅ Document uploaded: {}", document.id);
// Validate document response structure using our types // Validate document response structure using our types
assert!(!document.filename.is_empty()); assert!(!document.filename.is_empty());
@ -227,18 +227,18 @@ Technology: Rust + Axum + SQLx"#;
assert_eq!(document.mime_type, "text/plain"); assert_eq!(document.mime_type, "text/plain");
// Wait for OCR processing // Wait for OCR processing
let ocr_completed = client.wait_for_ocr_completion(&document.document_id.to_string()).await let ocr_completed = client.wait_for_ocr_completion(&document.id.to_string()).await
.expect("Failed to wait for OCR completion"); .expect("Failed to wait for OCR completion");
assert!(ocr_completed, "OCR processing did not complete within timeout"); assert!(ocr_completed, "OCR processing did not complete within timeout");
println!("✅ OCR processing completed"); println!("✅ OCR processing completed");
// Retrieve OCR text // Retrieve OCR text
let ocr_data = client.get_ocr_text(&document.document_id.to_string()).await let ocr_data = client.get_ocr_text(&document.id.to_string()).await
.expect("Failed to retrieve OCR text"); .expect("Failed to retrieve OCR text");
// Validate OCR response structure // Validate OCR response structure
assert_eq!(ocr_data["document_id"], document.document_id.to_string()); assert_eq!(ocr_data["id"], document.id.to_string());
assert_eq!(ocr_data["filename"], document.filename); assert_eq!(ocr_data["filename"], document.filename);
assert!(ocr_data["has_ocr_text"].as_bool().unwrap_or(false)); assert!(ocr_data["has_ocr_text"].as_bool().unwrap_or(false));
@ -363,7 +363,7 @@ async fn test_document_list_structure() {
.expect("Failed to parse documents as DocumentResponse"); .expect("Failed to parse documents as DocumentResponse");
// Find our uploaded document // Find our uploaded document
let found_doc = documents.iter().find(|d| d.id.to_string() == document.document_id.to_string()) let found_doc = documents.iter().find(|d| d.id.to_string() == document.id.to_string())
.expect("Uploaded document should be in list"); .expect("Uploaded document should be in list");
// Validate structure matches our types // Validate structure matches our types

View File

@ -397,7 +397,7 @@ async fn test_document_label_assignment() -> Result<(), Box<dyn std::error::Erro
println!("Uploading test document..."); println!("Uploading test document...");
let document_content = b"This is a test document for label assignment testing."; let document_content = b"This is a test document for label assignment testing.";
let document = client.upload_document(document_content, "test_document.txt").await?; let document = client.upload_document(document_content, "test_document.txt").await?;
let document_id = document["document_id"].as_str().unwrap(); let document_id = document["id"].as_str().unwrap();
// Test: Assign single label // Test: Assign single label
println!("Testing single label assignment..."); println!("Testing single label assignment...");
@ -501,7 +501,7 @@ async fn test_system_labels_access() -> Result<(), Box<dyn std::error::Error>> {
println!("Testing system label assignment..."); println!("Testing system label assignment...");
let document_content = b"This is a test document for system label assignment."; let document_content = b"This is a test document for system label assignment.";
let document = client.upload_document(document_content, "system_label_test.txt").await?; let document = client.upload_document(document_content, "system_label_test.txt").await?;
let document_id = document["document_id"].as_str().unwrap(); let document_id = document["id"].as_str().unwrap();
// Find a system label to assign // Find a system label to assign
let important_label = system_labels.iter() let important_label = system_labels.iter()

View File

@ -110,7 +110,7 @@ impl OcrTestClient {
} }
let document: DocumentUploadResponse = response.json().await?; let document: DocumentUploadResponse = response.json().await?;
Ok((document.document_id, content.to_string())) Ok((document.id, content.to_string()))
} }
/// Get document details including OCR status /// Get document details including OCR status
@ -197,7 +197,7 @@ impl OcrTestClient {
} }
let document: DocumentUploadResponse = response.json().await?; let document: DocumentUploadResponse = response.json().await?;
Ok::<(Uuid, String), Box<dyn std::error::Error>>((document.document_id, content_owned)) Ok::<(Uuid, String), Box<dyn std::error::Error>>((document.id, content_owned))
} }
}) })
.collect(); .collect();

View File

@ -181,7 +181,7 @@ impl OCRQueueTestClient {
let document: DocumentUploadResponse = response.json().await?; let document: DocumentUploadResponse = response.json().await?;
println!("📄 Document uploaded: {} (filename: {}, size: {})", println!("📄 Document uploaded: {} (filename: {}, size: {})",
document.document_id, filename, document.file_size); document.id, filename, document.file_size);
Ok(document) Ok(document)
} }
@ -322,7 +322,7 @@ async fn test_queue_stats_monitoring() {
let document = client.upload_document("Test document for queue monitoring", "queue_test.txt").await let document = client.upload_document("Test document for queue monitoring", "queue_test.txt").await
.expect("Failed to upload document"); .expect("Failed to upload document");
println!("✅ Document uploaded: {}", document.document_id); println!("✅ Document uploaded: {}", document.id);
// Wait a moment for queue to update // Wait a moment for queue to update
sleep(Duration::from_secs(2)).await; sleep(Duration::from_secs(2)).await;

View File

@ -247,7 +247,7 @@ impl OcrRetryTestHelper {
} }
let upload_result: Value = response.json().await?; let upload_result: Value = response.json().await?;
let doc_id = upload_result["document_id"].as_str() let doc_id = upload_result["id"].as_str()
.ok_or("No document ID in upload response")? .ok_or("No document ID in upload response")?
.to_string(); .to_string();
@ -411,7 +411,7 @@ async fn test_document_retry_history() {
println!("✅ Document retry history endpoint working"); println!("✅ Document retry history endpoint working");
// Verify response structure // Verify response structure
assert!(history["document_id"].is_string(), "Should have document_id"); assert!(history["id"].is_string(), "Should have document_id");
assert!(history["retry_history"].is_array(), "Should have retry_history array"); assert!(history["retry_history"].is_array(), "Should have retry_history array");
assert!(history["total_retries"].is_number(), "Should have total_retries count"); assert!(history["total_retries"].is_number(), "Should have total_retries count");

View File

@ -317,7 +317,7 @@ async fn test_high_volume_document_uploads() {
let result = client_clone.timed_upload(&content, &filename).await; let result = client_clone.timed_upload(&content, &filename).await;
match result { match result {
Ok((document, duration)) => (i, true, duration, Some(document.document_id.to_string())), Ok((document, duration)) => (i, true, duration, Some(document.id.to_string())),
Err(_) => (i, false, Duration::ZERO, None), Err(_) => (i, false, Duration::ZERO, None),
} }
}); });
@ -491,7 +491,7 @@ async fn test_search_performance_with_load() {
match client.timed_upload(&content, &filename).await { match client.timed_upload(&content, &filename).await {
Ok((document, _)) => { Ok((document, _)) => {
document_ids.push(document.document_id.to_string()); document_ids.push(document.id.to_string());
} }
Err(e) => { Err(e) => {
println!("⚠️ Failed to upload document {}: {}", i, e); println!("⚠️ Failed to upload document {}: {}", i, e);

View File

@ -409,7 +409,7 @@ async fn test_document_ownership_isolation() {
"user1_private.txt" "user1_private.txt"
).await.expect("Failed to upload User1 document"); ).await.expect("Failed to upload User1 document");
let user1_doc_id = user1_doc["id"].as_str().expect("Document should have ID"); let user1_doc_id = user1_doc["id"].as_str().expect("Document should have document_id");
println!("✅ User1 uploaded document: {}", user1_doc_id); println!("✅ User1 uploaded document: {}", user1_doc_id);
// User2 uploads a document // User2 uploads a document
@ -419,7 +419,7 @@ async fn test_document_ownership_isolation() {
"user2_private.txt" "user2_private.txt"
).await.expect("Failed to upload User2 document"); ).await.expect("Failed to upload User2 document");
let user2_doc_id = user2_doc["id"].as_str().expect("Document should have ID"); let user2_doc_id = user2_doc["id"].as_str().expect("Document should have document_id");
println!("✅ User2 uploaded document: {}", user2_doc_id); println!("✅ User2 uploaded document: {}", user2_doc_id);
// Test document list isolation // Test document list isolation