stormchaser_api/db/
artifacts.rs1use sqlx::PgPool;
2use stormchaser_model::RunId;
3
4use stormchaser_model::storage;
5
6pub async fn list_run_artifacts(
8 pool: &PgPool,
9 run_id: RunId,
10) -> Result<Vec<storage::ArtifactRegistry>, sqlx::Error> {
11 sqlx::query_as(
12 r#"
13 WITH combined_artifacts AS (
14 SELECT * FROM artifact_registry
15 UNION ALL
16 SELECT * FROM archived_artifact_registry
17 )
18 SELECT * FROM combined_artifacts WHERE run_id = $1 ORDER BY created_at ASC
19 "#,
20 )
21 .bind(run_id)
22 .fetch_all(pool)
23 .await
24}