diff --git a/api/libs/database/src/types.rs b/api/libs/database/src/types.rs index 0812939a4..4f48c7da6 100644 --- a/api/libs/database/src/types.rs +++ b/api/libs/database/src/types.rs @@ -1,5 +1,6 @@ use std::io::Write; +use chrono::{DateTime, Utc}; use diesel::{ deserialize::FromSql, pg::Pg, @@ -18,6 +19,7 @@ pub struct VersionHistory(pub std::collections::HashMap); #[derive(Debug, Serialize, Deserialize, Clone)] pub struct Version { pub version_number: i32, + pub updated_at: DateTime, pub content: Value, } @@ -28,6 +30,7 @@ impl VersionHistory { Version { content, version_number, + updated_at: Utc::now(), }, )])) } @@ -38,6 +41,7 @@ impl VersionHistory { Version { content, version_number, + updated_at: Utc::now(), }, ); } diff --git a/api/libs/handlers/src/metrics/get_metric_handler.rs b/api/libs/handlers/src/metrics/get_metric_handler.rs index 0992aa89f..a1c49e830 100644 --- a/api/libs/handlers/src/metrics/get_metric_handler.rs +++ b/api/libs/handlers/src/metrics/get_metric_handler.rs @@ -14,6 +14,8 @@ use database::enums::Verification; use database::pool::get_pg_pool; use database::schema::{datasets, metric_files}; +use super::Version; + #[derive(Queryable, Selectable)] #[diesel(table_name = metric_files)] struct QueryableMetricFile { @@ -154,6 +156,16 @@ pub async fn get_metric_handler(metric_id: &Uuid, user_id: &Uuid) -> Result Result, } #[derive(Debug, Serialize, Deserialize, Clone)] @@ -42,7 +43,7 @@ pub struct BusterMetric { pub code: Option, pub dashboards: Vec, pub collections: Vec, - pub versions: VersionHistory, + pub versions: Vec, } #[derive(Debug, Serialize, Deserialize, Clone)]