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;