From c2ccf4a3a15f23fd46202100a6ebf37a1ea19de6 Mon Sep 17 00:00:00 2001 From: Patrick Sullivan Date: Thu, 9 Jan 2025 21:42:56 -0600 Subject: [PATCH] fix: Fix new `UpdateAlert` endpoint (#5652) --- src/handler/http/models/alerts/mod.rs | 2 +- src/infra/src/table/alerts/mod.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/handler/http/models/alerts/mod.rs b/src/handler/http/models/alerts/mod.rs index 91ec2e968c..2c5745a16b 100644 --- a/src/handler/http/models/alerts/mod.rs +++ b/src/handler/http/models/alerts/mod.rs @@ -449,7 +449,7 @@ impl From for StreamType { impl From for meta_alerts::alert::Alert { fn from(value: Alert) -> Self { Self { - id: None, + id: value.id, name: value.name, org_id: value.org_id, stream_type: value.stream_type.into(), diff --git a/src/infra/src/table/alerts/mod.rs b/src/infra/src/table/alerts/mod.rs index dcedc1e7a5..7080352578 100644 --- a/src/infra/src/table/alerts/mod.rs +++ b/src/infra/src/table/alerts/mod.rs @@ -310,7 +310,7 @@ pub async fn create( Ok(alert) } -/// Creates a new alert in the database. Returns the new alert. +/// Updates an alert in the database. Returns the new alert. pub async fn update( conn: &C, org_id: &str, @@ -319,7 +319,7 @@ pub async fn update( ) -> Result { // Ensure that ID is provided. let Some(alert_id) = alert.id else { - return Err(errors::DbError::PutAlert(PutAlertError::CreateAlertSetID).into()); + return Err(errors::DbError::PutAlert(PutAlertError::UpdateAlertMissingID).into()); }; let _lock = super::get_lock().await;