fix: Fix new UpdateAlert endpoint (#5652)

This commit is contained in:
Patrick Sullivan
2025-01-09 21:42:56 -06:00
committed by GitHub
parent 0383959603
commit c2ccf4a3a1
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -449,7 +449,7 @@ impl From<meta_stream::StreamType> for StreamType {
impl From<Alert> 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(),
+2 -2
View File
@@ -310,7 +310,7 @@ pub async fn create<C: TransactionTrait>(
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<C: TransactionTrait + ConnectionTrait>(
conn: &C,
org_id: &str,
@@ -319,7 +319,7 @@ pub async fn update<C: TransactionTrait + ConnectionTrait>(
) -> Result<MetaAlert, errors::Error> {
// 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;