fix(tests): resolve issue in compilation of tests due to multiple ocr languages

This commit is contained in:
perf3ct 2025-07-13 17:26:06 +00:00
parent 5671038bd1
commit b048cfecee
No known key found for this signature in database
GPG Key ID: 569C4EEC436F5232
1 changed files with 1 additions and 24 deletions

View File

@ -39,7 +39,6 @@ pub async fn upload_document(
mut multipart: Multipart,
) -> Result<Json<DocumentUploadResponse>, StatusCode> {
let mut uploaded_file = None;
let mut label_ids: Option<Vec<uuid::Uuid>> = None;
let mut ocr_language: Option<String> = None;
// First pass: collect all multipart fields
@ -49,20 +48,7 @@ pub async fn upload_document(
})? {
let name = field.name().unwrap_or("").to_string();
if name == "label_ids" {
let label_ids_text = field.text().await.map_err(|_| StatusCode::BAD_REQUEST)?;
if !label_ids_text.trim().is_empty() {
match serde_json::from_str::<Vec<uuid::Uuid>>(&label_ids_text) {
Ok(ids) => {
label_ids = Some(ids);
info!("Label IDs specified in upload: {:?}", label_ids);
},
Err(e) => {
warn!("Failed to parse label_ids from upload: {} - Error: {}", label_ids_text, e);
}
}
}
} else if name == "ocr_language" {
if name == "ocr_language" {
let language = field.text().await.map_err(|_| StatusCode::BAD_REQUEST)?;
if !language.trim().is_empty() {
// Validate that the language is available
@ -166,15 +152,6 @@ pub async fn upload_document(
}
}
// If label IDs were specified, assign them to the document
if let Some(ref ids) = label_ids {
if let Err(e) = state.db.update_document_labels(document.id, ids.clone()).await {
warn!("Failed to assign labels to document {}: {}", document.id, e);
} else {
info!("Assigned {} labels to document {}", ids.len(), document.id);
}
}
// Auto-enqueue document for OCR processing
let priority = 5; // Normal priority for direct uploads
if let Err(e) = state.queue_service.enqueue_document(document.id, priority, document.file_size).await {