| 284 | } |
| 285 | |
| 286 | pub fn new_with_pages( |
| 287 | task: FileTaskClickhouse, |
| 288 | pages: Vec<ChunkClickhouse>, |
| 289 | file_url: String, |
| 290 | ) -> Self { |
| 291 | Self { |
| 292 | id: task.id.clone(), |
| 293 | file_name: task.file_name.clone(), |
| 294 | file_url: Some(file_url), |
| 295 | total_document_pages: task.pages, |
| 296 | pages_processed: task.pages_processed, |
| 297 | status: task.status, |
| 298 | created_at: task.created_at.to_string(), |
| 299 | pagination_token: pages.last().map(|c| c.id.clone()), |
| 300 | pages: Some(pages.into_iter().map(Chunk::from).collect()), |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | pub fn new_with_chunkr(task: FileTaskClickhouse, chunkr_task: TaskResponse) -> Self { |
| 305 | let pages = Vec::from(chunkr_task.clone()); |