(
&self,
sandbox_id: &str,
status_filter: Option<&str>,
)
| 702 | } |
| 703 | |
| 704 | pub async fn list_draft_chunks( |
| 705 | &self, |
| 706 | sandbox_id: &str, |
| 707 | status_filter: Option<&str>, |
| 708 | ) -> PersistenceResult<Vec<DraftChunkRecord>> { |
| 709 | let rows = if let Some(status) = status_filter { |
| 710 | sqlx::query( |
| 711 | r#" |
| 712 | SELECT "id", "scope", "status", "hit_count", "payload", "created_at_ms", "updated_at_ms" |
| 713 | FROM "objects" |
| 714 | WHERE "object_type" = ?1 AND "scope" = ?2 AND "status" = ?3 |
| 715 | ORDER BY "created_at_ms" DESC |
| 716 | "#, |
| 717 | ) |
| 718 | .bind(DRAFT_CHUNK_OBJECT_TYPE) |
| 719 | .bind(sandbox_id) |
| 720 | .bind(status) |
| 721 | .fetch_all(&self.pool) |
| 722 | .await |
| 723 | } else { |
| 724 | sqlx::query( |
| 725 | r#" |
| 726 | SELECT "id", "scope", "status", "hit_count", "payload", "created_at_ms", "updated_at_ms" |
| 727 | FROM "objects" |
| 728 | WHERE "object_type" = ?1 AND "scope" = ?2 |
| 729 | ORDER BY "created_at_ms" DESC |
| 730 | "#, |
| 731 | ) |
| 732 | .bind(DRAFT_CHUNK_OBJECT_TYPE) |
| 733 | .bind(sandbox_id) |
| 734 | .fetch_all(&self.pool) |
| 735 | .await |
| 736 | } |
| 737 | .map_err(|e| map_db_error(&e))?; |
| 738 | |
| 739 | rows.into_iter().map(row_to_draft_chunk_record).collect() |
| 740 | } |
| 741 | |
| 742 | pub async fn update_draft_chunk_status( |
| 743 | &self, |
no test coverage detected