feat(server): rename requeue failed endpoint

This commit is contained in:
perf3ct 2025-07-11 21:44:53 +00:00
parent e16fd1d420
commit acbb43afb8
2 changed files with 9 additions and 4 deletions

View File

@ -142,7 +142,7 @@ impl OCRQueueTestClient {
let token = self.token.as_ref().ok_or("Not authenticated")?; let token = self.token.as_ref().ok_or("Not authenticated")?;
let response = self.client let response = self.client
.post(&format!("{}/api/queue/requeue/failed", get_base_url())) .post(&format!("{}/api/queue/requeue-failed", get_base_url()))
.header("Authorization", format!("Bearer {}", token)) .header("Authorization", format!("Bearer {}", token))
.send() .send()
.await?; .await?;
@ -615,7 +615,7 @@ async fn test_queue_error_handling() {
// Test unauthorized requeue attempt // Test unauthorized requeue attempt
let unauth_requeue_response = unauth_client let unauth_requeue_response = unauth_client
.post(&format!("{}/api/queue/requeue/failed", get_base_url())) .post(&format!("{}/api/queue/requeue-failed", get_base_url()))
.send() .send()
.await .await
.expect("Request should complete"); .expect("Request should complete");

View File

@ -17,6 +17,7 @@ use serde_json::{json, Value};
use uuid::Uuid; use uuid::Uuid;
use readur::models::{CreateUser, LoginRequest, LoginResponse, UserRole}; use readur::models::{CreateUser, LoginRequest, LoginResponse, UserRole};
use readur::routes::documents::types::PaginatedDocumentsResponse;
fn get_base_url() -> String { fn get_base_url() -> String {
std::env::var("API_URL").unwrap_or_else(|_| "http://localhost:8000".to_string()) std::env::var("API_URL").unwrap_or_else(|_| "http://localhost:8000".to_string())
@ -223,7 +224,11 @@ impl RBACTestClient {
return Err(format!("Get documents failed: {}", response.text().await?).into()); return Err(format!("Get documents failed: {}", response.text().await?).into());
} }
let documents: Vec<Value> = response.json().await?; let paginated_response: PaginatedDocumentsResponse = response.json().await?;
let documents: Vec<Value> = paginated_response.documents
.into_iter()
.map(|doc| serde_json::to_value(doc).unwrap())
.collect();
Ok(documents) Ok(documents)
} }
@ -343,7 +348,7 @@ impl RBACTestClient {
} }
AdminOperation::RequeueFailedJobs => { AdminOperation::RequeueFailedJobs => {
self.client self.client
.post(&format!("{}/api/queue/requeue/failed", get_base_url())) .post(&format!("{}/api/queue/requeue-failed", get_base_url()))
.header("Authorization", format!("Bearer {}", token)) .header("Authorization", format!("Bearer {}", token))
.send() .send()
.await? .await?