mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-06 16:09:41 +00:00
fix: Fix query in V2 ListAlerts (#6162)
This commit is contained in:
@@ -27,8 +27,9 @@ use config::meta::{
|
||||
use hashbrown::HashMap;
|
||||
use itertools::Itertools;
|
||||
use sea_orm::{
|
||||
ActiveModelTrait, ColumnTrait, ConnectionTrait, EntityTrait, ModelTrait, PaginatorTrait,
|
||||
QueryFilter, QueryOrder, Set, TransactionTrait, TryIntoModel, prelude::Expr, sea_query::Func,
|
||||
ActiveModelTrait, ColumnTrait, ConnectionTrait, DeriveIden, EntityTrait, ModelTrait,
|
||||
PaginatorTrait, QueryFilter, QueryOrder, Set, TransactionTrait, TryIntoModel, prelude::Expr,
|
||||
sea_query::Func,
|
||||
};
|
||||
use svix_ksuid::{Ksuid, KsuidLike};
|
||||
|
||||
@@ -501,7 +502,9 @@ async fn list_models<C: ConnectionTrait>(
|
||||
let name_substring = params.name_substring.filter(|n| !n.is_empty());
|
||||
let query = if let Some(name_substring) = name_substring {
|
||||
let name_pattern = format!("%{}%", name_substring.to_lowercase());
|
||||
query.filter(Expr::expr(Func::lower(Expr::col(alerts::Column::Name))).like(name_pattern))
|
||||
query.filter(
|
||||
Expr::expr(Func::lower(Expr::col((Alerts::Table, Alerts::Name)))).like(name_pattern),
|
||||
)
|
||||
} else {
|
||||
query
|
||||
};
|
||||
@@ -681,3 +684,9 @@ fn update_mutable_fields(
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(DeriveIden)]
|
||||
enum Alerts {
|
||||
Table,
|
||||
Name,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user