mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-05 00:09:35 +00:00
fix: Fix new UpdateAlert endpoint (#5652)
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user