From c53177d3ee5bdf448ae8f11bfd5030abca6f8e19 Mon Sep 17 00:00:00 2001 From: dal Date: Tue, 18 Mar 2025 23:51:52 -0600 Subject: [PATCH] dashboard and testing stuff --- api/libs/database/src/helpers/dashboard_files.rs | 10 +++++++++- api/libs/handlers/tests/metrics/mod.rs | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/api/libs/database/src/helpers/dashboard_files.rs b/api/libs/database/src/helpers/dashboard_files.rs index c197efcb0..0c4ec0e69 100644 --- a/api/libs/database/src/helpers/dashboard_files.rs +++ b/api/libs/database/src/helpers/dashboard_files.rs @@ -25,7 +25,15 @@ pub async fn fetch_dashboard_file(id: &Uuid) -> Result> { .first::(&mut conn) .await { - Ok(result) => Some(result), + Ok(mut result) => { + // Ensure all rows have IDs (for backwards compatibility) + for (index, row) in result.content.rows.iter_mut().enumerate() { + if row.id.is_none() { + row.id = Some((index as u32) + 1); + } + } + Some(result) + }, Err(diesel::NotFound) => None, Err(e) => return Err(e.into()), }; diff --git a/api/libs/handlers/tests/metrics/mod.rs b/api/libs/handlers/tests/metrics/mod.rs index 9f84da195..fd8b7115a 100644 --- a/api/libs/handlers/tests/metrics/mod.rs +++ b/api/libs/handlers/tests/metrics/mod.rs @@ -116,6 +116,7 @@ pub async fn create_test_dashboard(organization_id: Uuid, created_by: Uuid) -> R name: "Test Dashboard".to_string(), description: Some("Test dashboard description".to_string()), rows: vec![database::types::Row { + id: None, items: vec![database::types::RowItem { id: Uuid::new_v4() }], row_height: Some(320), column_sizes: None,