| 302 | } |
| 303 | |
| 304 | pub fn new_with_chunkr(task: FileTaskClickhouse, chunkr_task: TaskResponse) -> Self { |
| 305 | let pages = Vec::from(chunkr_task.clone()); |
| 306 | Self { |
| 307 | id: task.id.clone(), |
| 308 | file_name: task.file_name.clone(), |
| 309 | file_url: Some(chunkr_task.pdf_url.unwrap_or_default()), |
| 310 | total_document_pages: task.pages, |
| 311 | pages_processed: match chunkr_task.status { |
| 312 | Status::Succeeded => task.pages, |
| 313 | _ => 0, |
| 314 | }, |
| 315 | status: format!("{}", chunkr_task.status), |
| 316 | created_at: task.created_at.to_string(), |
| 317 | pagination_token: None, |
| 318 | pages: Some(pages), |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | #[derive(Debug, serde::Serialize, serde::Deserialize, Display, Clone, PartialEq, Eq, ToSchema)] |