(
&self,
sandbox_id: &str,
status_filter: Option<&str>,
)
| 680 | } |
| 681 | |
| 682 | pub async fn list_draft_chunks( |
| 683 | &self, |
| 684 | sandbox_id: &str, |
| 685 | status_filter: Option<&str>, |
| 686 | ) -> PersistenceResult<Vec<DraftChunkRecord>> { |
| 687 | let rows = if let Some(status) = status_filter { |
| 688 | sqlx::query( |
| 689 | r" |
| 690 | SELECT id, scope, status, hit_count, payload, created_at_ms, updated_at_ms |
| 691 | FROM objects |
| 692 | WHERE object_type = $1 AND scope = $2 AND status = $3 |
| 693 | ORDER BY created_at_ms DESC |
| 694 | ", |
| 695 | ) |
| 696 | .bind(DRAFT_CHUNK_OBJECT_TYPE) |
| 697 | .bind(sandbox_id) |
| 698 | .bind(status) |
| 699 | .fetch_all(&self.pool) |
| 700 | .await |
| 701 | } else { |
| 702 | sqlx::query( |
| 703 | r" |
| 704 | SELECT id, scope, status, hit_count, payload, created_at_ms, updated_at_ms |
| 705 | FROM objects |
| 706 | WHERE object_type = $1 AND scope = $2 |
| 707 | ORDER BY created_at_ms DESC |
| 708 | ", |
| 709 | ) |
| 710 | .bind(DRAFT_CHUNK_OBJECT_TYPE) |
| 711 | .bind(sandbox_id) |
| 712 | .fetch_all(&self.pool) |
| 713 | .await |
| 714 | } |
| 715 | .map_err(|e| map_db_error(&e))?; |
| 716 | |
| 717 | rows.into_iter().map(row_to_draft_chunk_record).collect() |
| 718 | } |
| 719 | |
| 720 | pub async fn update_draft_chunk_status( |
| 721 | &self, |
nothing calls this directly
no test coverage detected