(
&self,
sandbox_id: &str,
)
| 472 | } |
| 473 | |
| 474 | pub async fn get_latest_policy( |
| 475 | &self, |
| 476 | sandbox_id: &str, |
| 477 | ) -> PersistenceResult<Option<PolicyRecord>> { |
| 478 | let row = sqlx::query( |
| 479 | r" |
| 480 | SELECT id, scope, version, status, payload, created_at_ms |
| 481 | FROM objects |
| 482 | WHERE object_type = $1 AND scope = $2 |
| 483 | ORDER BY version DESC, created_at_ms DESC |
| 484 | LIMIT 1 |
| 485 | ", |
| 486 | ) |
| 487 | .bind(POLICY_OBJECT_TYPE) |
| 488 | .bind(sandbox_id) |
| 489 | .fetch_optional(&self.pool) |
| 490 | .await |
| 491 | .map_err(|e| map_db_error(&e))?; |
| 492 | |
| 493 | row.map(row_to_policy_record).transpose() |
| 494 | } |
| 495 | |
| 496 | pub async fn get_latest_loaded_policy( |
| 497 | &self, |
nothing calls this directly
no test coverage detected