From b0794bb5575ede6830a3e4067df596865e551790 Mon Sep 17 00:00:00 2001 From: adnanjpg Date: Wed, 17 Apr 2024 21:38:31 +0300 Subject: [PATCH] fix: app logs api filters --- src/logs/persistence/app_logs.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/logs/persistence/app_logs.rs b/src/logs/persistence/app_logs.rs index 8191ae3..a5237b5 100644 --- a/src/logs/persistence/app_logs.rs +++ b/src/logs/persistence/app_logs.rs @@ -166,7 +166,13 @@ pub async fn get_app_logs( // } // query.push(")"); - query.push(format!(" AND app_id IN ({})", app_ids.join(", "))); + let ids = app_ids + .iter() + .map(|l| format!("'{}'", l.to_string())) + .collect::>() + .join(", "); + + query.push(format!(" AND app_id IN ({})", ids)); } if let Some(filter_by_word) = filter_by_word { @@ -201,11 +207,14 @@ pub async fn get_app_logs( if let Some(order_by) = order_by { query.push(" ORDER BY "); - query.push(&order_by); + query.push(format!("'{}'", &order_by)); if let Some(order_by_direction) = order_by_direction { query.push(" "); - query.push(&order_by_direction.to_string()); + query.push(format!( + "{}", + &order_by_direction.to_string().to_lowercase() + )); } }